Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Does CQ clears /var cache automatically on package deployment

Avatar

Level 4

Hi all,

       Wanted to check on this. We are doing clientlib & JSP deployment on CQ server. To be on safer side we delete the /var cache directory in CQ  - Is this absolutely neccessary to clear /var cache or does CQ has any mechanism  where-in it detects that there is new version of file on the server so it will rebuilt the cache.

       Below are the 2 directories which we delete

        /var/classes/org/apache/jsp/apps

        /var/clientlibs

        Is there any special setting in CQ to enable this automated cache re-build after deployment ?   I   

       Thanks in advance.

        Rohit

1 Accepted Solution

Avatar

Correct answer by
Level 5

Rohit,

Cache get rebuild based on update on actual file. If jsp on a package get updated, then corresponding class file under /var/classes also get updated upon next request. Same goes true for clientlib as well. To force recompilation you can restart Apache Sling Scripting JSP Supportorg.apache.sling.scripting.jsp bundle from felix console for jsp and Adobe Granite UI Commonscom.day.cq.cq-widgets) for clientlib.

You can also do something like http://HOST:PORT/system/console/slingjsp in CQ6 for force recompilation as well (Can do it through CURL)

But these steps should not be required, If you have to do that, That means there is some bug and you should report it.

Yogesh

View solution in original post

2 Replies

Avatar

Correct answer by
Level 5

Rohit,

Cache get rebuild based on update on actual file. If jsp on a package get updated, then corresponding class file under /var/classes also get updated upon next request. Same goes true for clientlib as well. To force recompilation you can restart Apache Sling Scripting JSP Supportorg.apache.sling.scripting.jsp bundle from felix console for jsp and Adobe Granite UI Commonscom.day.cq.cq-widgets) for clientlib.

You can also do something like http://HOST:PORT/system/console/slingjsp in CQ6 for force recompilation as well (Can do it through CURL)

But these steps should not be required, If you have to do that, That means there is some bug and you should report it.

Yogesh

Avatar

Level 2

There was a bug in 5.4 where this did not work, but in more recent versions I think it should work.

There may be a case of some weird includes or circular references, but then you need to give more details.

Also check the files in your code packages, is there something that changes with each deployment, like a version number in the comments? This could trigger a lot of recompiles potentially and may result in problems, see above.

If you really want to force cleaning it with every deployment, you can just add an empty /var/classes folder to your code package.