9

I am developing a theme for liferay,but liferay caching system does not let me to see changes. How can i disable liferay js and css caching?

PS: I am using Liferay version 5.1.1

tak3shi
  • 2,305
  • 1
  • 20
  • 33
rahim asgari
  • 12,197
  • 10
  • 43
  • 53

4 Answers4

13

Under Tomcat (bundled)

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.

This is however for the later version 5.2.3+ Not sure why you are still @ 5.1.1, I would update to take advantage of some updated structure and dev handling. In the past there was more work required to get the caching disabled.

Reference: http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Liferay%2BDeveloper%2BMode

Jakub
  • 20,418
  • 8
  • 65
  • 92
  • 2
    Just to add more information to the @Jakub's reply. The file `portal-developer.properties` is already bundled in Liferay so don't worry to create one and/or to ask about what it should contains. In a standard Liferay installation (bundled with Tomcat) it should be located in: `./webapps/ROOT/WEB-INF/classes/portal-developer.properties`. – Rubens Mariuzzo Apr 05 '11 at 15:16
  • @Rubens Mariuzzo, welcome, I know what a pain Liferay can be to work with ;) – Jakub Apr 05 '11 at 18:25
  • 1
    Indeed, Liferay is pretty useful, but can make you spend hours in simple and common tasks for developers. – Rubens Mariuzzo Apr 05 '11 at 20:29
  • 1
    I'd like to suggest to change JAVA_OPTS to CATALINA_OPTS. Reference, justification and outcome: https://issues.liferay.com/browse/LPS-26464 – Olaf Kock Jan 20 '13 at 20:44
  • After making this change, is the restart of tomcat necessary? – Ralph David Abernathy Feb 19 '16 at 18:26
6

it's all about Liferay servlet filters. You need to turn some of them off. The best place for that is portal-developer-ext.properties.

You make liferay read it by 2 possible ways :

JVM parameter  -Dexternal-properties=portal-developer-ext.properties

or add this property to portal-ext.properties

include-and-override=portal-developer-ext.properties
lisak
  • 21,611
  • 40
  • 152
  • 243
  • Thanks for the bit about 'include-and-override'. I put that in my portal-ext.properties file on my Liferay 6.1.0 server and it worked! – CatsAndCode Jan 11 '12 at 17:49
1

To disable caching of JS and CSS resources in Liferay Portal 6.1+*, add the following line to your portal-ext.propeties file:

browser.cache.disabled=true

*This may work in older versions as well, but I haven't tested it.

stiemannkj1
  • 4,418
  • 3
  • 25
  • 45
0

Below link have complete details how to manage caching in liferay

http://www.liferay.com/community/forums/-/message_boards/message/10626805

lucky
  • 147
  • 5
  • 3
    As links tend to go off-line earlier or later, you could try to provide a summary of the things shown on that site. – Nippey Oct 15 '12 at 06:02
  • Read the page, it's actually not about caching but about running a one-time-import. (Only in the title there is something written with caching of *.proerties files) – Manuel Manhart Jul 17 '20 at 11:34