tonylefler tonylefler - 1 month ago 8
Groovy Question

Disable Caching in Tomcat Grails

I need to disable caching during development. Currently I have to rerun the

run-app
command every time I make changes to JS or CSS (which takes 5-10 minutes). This legacy project I inherited is using Grails with embedded Tomcat.

Examples online talk about configuring Tomcat within a
eventConfigureTomcat
hook inside the
_Events.groovy
file:

eventConfigureTomcat = { tomcat ->
}


but I can't find any documentation on how to apply
cachingAllowed=false
:

<Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="false">
</Context>


Please keep in mind that I'm a complete Java noob - just looking for someone to point me in the right direction.

jja jja
Answer

You didn't specify your Grails version. Starting at 2.3 you need to add -reloading e.g.

grails -reloading run-app

This works for me and serves the changed files, as long as the browser is actually making requests and not caching things itself.

In 3.x this may no longer be needed but there are config options for reloading that may be excluding your js/css. Search the docs for "reloading" for details.