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 添付ファイル
116883 参照数
平均 (6 投票)
平均評価は4.83333333333333星中の5です。
コメント
コメント 作成者 日時
Hi, nice article, but what will relay put me... Radu B 2008/12/19 11:04
i'm waiting for new feature of liferay support... Ton Hoang 2009/01/21 2:39
>> If you are using a version of Liferay... b v j 2009/02/05 12:57
i couldnt find in catalina.sh file but found at... delang j 2009/03/23 22:02
Hi, the modification-based cache of web... relax sun 2009/05/07 3:54
Instead if I edit a JSP under portlet of... relax sun 2009/10/23 7:40
For Liferay Tomcat bundle let's see:... relax sun 2009/11/25 1:37
I am using Liferay 5.2.3 and Tomcat 6.0, and I... Boen Liem 2010/03/02 13:12
I found the problem myself. I was editing the... Boen Liem 2010/03/02 13:32
Hello This tip doesn't work with my Liferay... Amine Bousta 2009/05/07 10:37
It is working from me with the JBoss bundle for... Carlos Thompson 2009/06/06 17:28
Correct me if I'm wrong but I think there's... Timo Arnivuo 2009/06/10 4:21
is it a correct way of overriding? Nagendra Kumar Busam 2009/08/28 7:40
The simple way Timo suggested at least worked... Marcus Björke 2009/08/31 5:52
Avoiding minifying the HTML returned : for... Angelo Natal 2010/05/19 0:41
If you're running tomcat from Liferay IDE... Jin Joo 2011/01/22 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!
投稿日時:08/12/19 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
Radu Bへのコメント。投稿日時:09/01/21 2:39
>> 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?
投稿日時:09/02/05 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
投稿日時:09/03/23 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?
投稿日時:09/05/07 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
投稿日時:09/05/07 10:37
It is working from me with the JBoss bundle for 5.2.2 by executing
run.bat -Dexternal-properties=portal-developer.properties
Amine Boustaへのコメント。投稿日時:09/06/06 17:28
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
投稿日時:09/06/10 4:21
Timo Arnivuoへのコメント。投稿日時:09/08/28 7:40
The simple way Timo suggested at least worked for me, I'm using version 5.2.
Nagendra Kumar Busamへのコメント。投稿日時:09/08/31 5:52
Instead if I edit a JSP under portlet of liferay root, it is updated!

Why?
Giuseppe Cinqueへのコメント。投稿日時:09/10/23 7:40
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!
relax sunへのコメント。投稿日時:09/11/25 1:37
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?
relax sunへのコメント。投稿日時:10/03/02 13:12
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.
Boen Liemへのコメント。投稿日時:10/03/02 13:32
Avoiding minifying the HTML returned :

for WINDOWS I think it should be ?strip=0 instead of &strip=0
投稿日時:10/05/19 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
投稿日時:11/01/22 23:09