
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 #
- Edit the setenv.sh file (setenv.bat on windows)
- Search for the line that sets the JAVA_OPTS variable
- 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.