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 archivos adjuntos
116881 Accesos
Promedio (6 Votos)
La valoración media es de 4.83333333333333 estrellas de 5.
Comentarios
Respuestas anidadas Autor Fecha
Hi, nice article, but what will relay put me... Radu B 19 de diciembre de 2008 11:04
i'm waiting for new feature of liferay support... Ton Hoang 21 de enero de 2009 2:39
>> If you are using a version of Liferay... b v j 5 de febrero de 2009 12:57
i couldnt find in catalina.sh file but found at... delang j 23 de marzo de 2009 22:02
Hi, the modification-based cache of web... relax sun 7 de mayo de 2009 3:54
Instead if I edit a JSP under portlet of... relax sun 23 de octubre de 2009 7:40
For Liferay Tomcat bundle let's see:... relax sun 25 de noviembre de 2009 1:37
I am using Liferay 5.2.3 and Tomcat 6.0, and I... Boen Liem 2 de marzo de 2010 13:12
I found the problem myself. I was editing the... Boen Liem 2 de marzo de 2010 13:32
Hello This tip doesn't work with my Liferay... Amine Bousta 7 de mayo de 2009 10:37
It is working from me with the JBoss bundle for... Carlos Thompson 6 de junio de 2009 17:28
Correct me if I'm wrong but I think there's... Timo Arnivuo 10 de junio de 2009 4:21
is it a correct way of overriding? Nagendra Kumar Busam 28 de agosto de 2009 7:40
The simple way Timo suggested at least worked... Marcus Björke 31 de agosto de 2009 5:52
Avoiding minifying the HTML returned : for... Angelo Natal 19 de mayo de 2010 0:41
If you're running tomcat from Liferay IDE... Jin Joo 22 de enero 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!
Publicado el día 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
Publicado el día 21/01/09 2:39 en respuesta 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?
Publicado el día 5/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
Publicado el día 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?
Publicado el día 7/05/09 3: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
Publicado el día 7/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
Publicado el día 6/06/09 17:28 en respuesta 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
Publicado el día 10/06/09 4:21.
is it a correct way of overriding?
Publicado el día 28/08/09 7:40 en respuesta a Timo Arnivuo.
The simple way Timo suggested at least worked for me, I'm using version 5.2.
Publicado el día 31/08/09 5:52 en respuesta a Nagendra Kumar Busam.
Instead if I edit a JSP under portlet of liferay root, it is updated!

Why?
Publicado el día 23/10/09 7:40 en respuesta 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!
Publicado el día 25/11/09 1:37 en respuesta 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?
Publicado el día 2/03/10 13:12 en respuesta 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.
Publicado el día 2/03/10 13:32 en respuesta a Boen Liem.
Avoiding minifying the HTML returned :

for WINDOWS I think it should be ?strip=0 instead of &strip=0
Publicado el día 19/05/10 0: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
Publicado el día 22/01/11 23:09.