Liferay Developer Mode

Alternative Languages: 日本語

The Liferay Developer Mode optimizes Liferay Portal for development by removing all caches and thus making sure that any change made by the developer is visible in the website as soon as technically possible. One of the final goals is to avoid rebooting the server as much as possible.

How to set it up #

The developer mode is defined as a set of configuration properties that are stored in the portal-developer.properties file. In order to activate the developer mode you have to ensure that that file is loaded. The following sections explain how to achieve this:

Tomcat #

  1. Edit the setenv.sh file (setenv.bat on windows)
  2. Search for the line that sets the JAVA_OPTS variable
  3. Add -Dexternal-properties=portal-developer.properties to the list of options For example:
     JAVA_OPTS="-Xms256m -Xmx1024m -XX:PermSize=32m -XX:MaxPermSize=160m -Dfile.encoding=UTF8 -Duser.timezone=GMT+2 -Djava.security.auth.login.config=$CATALINA_HOME/conf/jaas.config -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Dexternal-properties=portal-developer.properties"
    Note that this has to be all on one line.

If you were already using the external-properties system property to load some other properties file, add portal-developer.properties with commas.

Other application servers #

Each application server has a different configuration file or UI to specify system properties. Read the application server manual to find out the specific method for your application server of choice and set: external-properties=portal-developer.properties If you were already using the external-properties system property to load some other properties file, add portal-developer.properties with commas.

Note for Liferay versions prior to Liferay 5.2 #

If you are using a version of Liferay previous to 5.2 the portal.properties file will not exist. But you can still set up the developer mode by copying portal-developer.properties into the classpath of your installation or right next to portal.properties or portal-ext.properties in your source code repository.

What it does #

At the time of writing, the developer mode applies the following changes:

  • The CSS of the themes is loaded as individual files instead as one big file (theme.css.fast.load=false)
    • This means that changes to the individual files of the theme will be applied immediately
  • The Javascript will be loaded as individual files instead as one big file (javascript.fast.load=false). This applies to all the portal javascript file plus any portlet javascript file registered through liferay-portlet.xml
  • The Javascript logs are enabled (javascript.log.enabled=true)
  • The cache of layout templates is disabled (layout.template.cache.enabled=false)
  • The server won't start a browser when starting up, This is a new behavior introduced in 5.2 that is not desired while developing (browser.launcher.url=)
  • The modification-based cache of web resources (such as the global CSS file, css_cached.jsp) is disabled (last.modified.check=false)
  • The velocity templates of themes and journal articles won't be cached so changes will be applied immediately. (velocity.engine.resource.manager.cache.enabled=false) By the time you read this there might be new settings so make sure to check the portal-developer.properties file in your version of Liferay for the most accurate information.

More #

Avoiding minifying the HTML returned #

Starting with Liferay v5.2 (and v5.1.4EE) the HTML that is returned from the portal is minified to reduce it's size and increase the parsing speed once in the browser.

While this is great in general it might be inconvenient when trying to debug a problem related to the HTML output or the CSS or JavaScript that it may have inline. To avoid that all you have to do is to append the following parameter to the URL:

&strip=0

We've decided to not do this by default in the developer mode because the minify process is sometimes useful to find certain types of problem in the HTML.

0 Anexos
116884 Visualizações
Média (6 Votos)
A média da avaliação é 4.83333333333333 estrelas de 5.
Comentários
Respostas do tópico Autor Data
Hi, nice article, but what will relay put me... Radu B 19 de Dezembro de 2008 11:04
i'm waiting for new feature of liferay support... Ton Hoang 21 de Janeiro de 2009 02:39
>> If you are using a version of Liferay... b v j 5 de Fevereiro de 2009 12:57
i couldnt find in catalina.sh file but found at... delang j 23 de Março de 2009 22:02
Hi, the modification-based cache of web... relax sun 7 de Maio de 2009 03:54
Instead if I edit a JSP under portlet of... relax sun 23 de Outubro de 2009 07:40
For Liferay Tomcat bundle let's see:... relax sun 25 de Novembro de 2009 01:37
I am using Liferay 5.2.3 and Tomcat 6.0, and I... Boen Liem 2 de Março de 2010 13:12
I found the problem myself. I was editing the... Boen Liem 2 de Março de 2010 13:32
Hello This tip doesn't work with my Liferay... Amine Bousta 7 de Maio de 2009 10:37
It is working from me with the JBoss bundle for... Carlos Thompson 6 de Junho de 2009 17:28
Correct me if I'm wrong but I think there's... Timo Arnivuo 10 de Junho de 2009 04:21
is it a correct way of overriding? Nagendra Kumar Busam 28 de Agosto de 2009 07:40
The simple way Timo suggested at least worked... Marcus Björke 31 de Agosto de 2009 05:52
Avoiding minifying the HTML returned : for... Angelo Natal 19 de Maio de 2010 00:41
If you're running tomcat from Liferay IDE... Jin Joo 22 de Janeiro de 2011 23:09

Hi,

nice article, but what will relay put me in "Developer Mode" will be the creation of ant target and support programs

"build-jsf-views"

promised for version 5.1 in the RoadMap here:
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/RoadMap

Chears,
R­adu!
Postado em 19/12/08 11:04.
i'm waiting for new feature of liferay

support friendly URL for each article (the page have some porlet, in that have one journal content to display each article)

Thank,

wake me up when we have 5.2 version
Postado em 21/01/09 02:39 em resposta a Radu B.
>> If you are using a version of Liferay previous to 5.2 the portal.properties file will not exist.

The portal.properties file exists in previous versions of Liferay. Are you referring to: portal-developer.properties?
Postado em 05/02/09 12:57.
i couldnt find in catalina.sh file but found at setenv.sh.
is it the same thing?
can i copy element in portal-developer.properties to portal-ext.properties?

thanks
Postado em 23/03/09 22:02.
Hi, the modification-based cache of web resources is enabled also with
1. add -Dexternal-properties=portal-developer.properties to the list of options
2. last.modified.check=false in portal-developer.properties

I have a simple jsp in liferay-portal-5.2.2\tomcat-6.0.18\webapps\simpleportlet\view.jsp, if I modify view.jsp I only must restart server to view the modification.

Why?
Postado em 07/05/09 03:54.
Hello

This tip doesn't work with my Liferay 5.2.2 version
I always have to restart server for every single modification... emoticon
Postado em 07/05/09 10:37.
It is working from me with the JBoss bundle for 5.2.2 by executing
run.bat -Dexternal-properties=portal-developer.properties
Postado em 06/06/09 17:28 em resposta a Amine Bousta.
Correct me if I'm wrong but I think there's much easier way enabling developer mode by adding one line to portal-ext.properties.

include-and-override=portal-developer.properties
Postado em 10/06/09 04:21.
is it a correct way of overriding?
Postado em 28/08/09 07:40 em resposta a Timo Arnivuo.
The simple way Timo suggested at least worked for me, I'm using version 5.2.
Postado em 31/08/09 05:52 em resposta a Nagendra Kumar Busam.
Instead if I edit a JSP under portlet of liferay root, it is updated!

Why?
Postado em 23/10/09 07:40 em resposta a Giuseppe Cinque.
For Liferay Tomcat bundle let's see:
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Fast+Development­+of+Liferay+Plugins+with+Tomcat

It's ok!
Postado em 25/11/09 01:37 em resposta a relax sun.
I am using Liferay 5.2.3 and Tomcat 6.0, and I still can not get into the developer mode. My changes in my jsp files are not recognized by liferay.

I noticed that the time on the tomcat console is 1 hr behind (Daylight saving time - I don't know it this has effect).

Any idea?
Postado em 02/03/10 13:12 em resposta a relax sun.
I found the problem myself.
I was editing the jsp in the wrong directory. The one I was editing was the "extracted" jsp in the webapps subdir.
I should have edited the one in %CATALINA_HOME%/temp/... directory.
Be aware, there can be multiple versions of your deployed application; choose the one with most recent timestamp.
Postado em 02/03/10 13:32 em resposta a Boen Liem.
Avoiding minifying the HTML returned :

for WINDOWS I think it should be ?strip=0 instead of &strip=0
Postado em 19/05/10 00:41.
If you're running tomcat from Liferay IDE (eclipse), you can follow these instructions: http://www.liferay.com/community/forums/-/message_boards/message/6707759#_19_mes­sage_6707684
Postado em 22/01/11 23:09.