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 Attachments
116879 Views
Average (6 Votes)
The average rating is 4.83333333333333 stars out of 5.
Comments
Threaded Replies Author Date
Hi, nice article, but what will relay put me... Radu B December 19, 2008 11:04 AM
i'm waiting for new feature of liferay support... Ton Hoang January 21, 2009 2:39 AM
>> If you are using a version of Liferay... b v j February 5, 2009 12:57 PM
i couldnt find in catalina.sh file but found at... delang j March 23, 2009 10:02 PM
Hi, the modification-based cache of web... relax sun May 7, 2009 3:54 AM
Instead if I edit a JSP under portlet of... relax sun October 23, 2009 7:40 AM
For Liferay Tomcat bundle let's see:... relax sun November 25, 2009 1:37 AM
I am using Liferay 5.2.3 and Tomcat 6.0, and I... Boen Liem March 2, 2010 1:12 PM
I found the problem myself. I was editing the... Boen Liem March 2, 2010 1:32 PM
Hello This tip doesn't work with my Liferay... Amine Bousta May 7, 2009 10:37 AM
It is working from me with the JBoss bundle for... Carlos Thompson June 6, 2009 5:28 PM
Correct me if I'm wrong but I think there's... Timo Arnivuo June 10, 2009 4:21 AM
is it a correct way of overriding? Nagendra Kumar Busam August 28, 2009 7:40 AM
The simple way Timo suggested at least worked... Marcus Björke August 31, 2009 5:52 AM
Avoiding minifying the HTML returned : for... Angelo Natal May 19, 2010 12:41 AM
If you're running tomcat from Liferay IDE... Jin Joo January 22, 2011 11:09 PM

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!
Posted on 12/19/08 11:04 AM.
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
Posted on 1/21/09 2:39 AM in reply to 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?
Posted on 2/5/09 12:57 PM.
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
Posted on 3/23/09 10:02 PM.
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?
Posted on 5/7/09 3:54 AM.
Hello

This tip doesn't work with my Liferay 5.2.2 version
I always have to restart server for every single modification... emoticon
Posted on 5/7/09 10:37 AM.
It is working from me with the JBoss bundle for 5.2.2 by executing
run.bat -Dexternal-properties=portal-developer.properties
Posted on 6/6/09 5:28 PM in reply to 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
Posted on 6/10/09 4:21 AM.
is it a correct way of overriding?
Posted on 8/28/09 7:40 AM in reply to Timo Arnivuo.
The simple way Timo suggested at least worked for me, I'm using version 5.2.
Posted on 8/31/09 5:52 AM in reply to Nagendra Kumar Busam.
Instead if I edit a JSP under portlet of liferay root, it is updated!

Why?
Posted on 10/23/09 7:40 AM in reply to 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!
Posted on 11/25/09 1:37 AM in reply to 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?
Posted on 3/2/10 1:12 PM in reply to 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.
Posted on 3/2/10 1:32 PM in reply to Boen Liem.
Avoiding minifying the HTML returned :

for WINDOWS I think it should be ?strip=0 instead of &strip=0
Posted on 5/19/10 12:41 AM.
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
Posted on 1/22/11 11:09 PM.