Kyle Banks

Fix Issue with Grails not Auto-Reloading Controllers in 2.1+

Written by @kylewbanks on Apr 2, 2013.

It seems that ever since Grails 2.1 arrived, controller classes have not been auto-reloaded when edited in a development environment. I'm not sure if this is now the intended behaviour of controllers, but it sure can make for slower development and debugging.

Luckily, you can make controllers auto-reload again with a simple VM argument when starting your Grails application:

-javaagent:${GRAILS_HOME}/lib/org.springsource.springloaded/springloaded-core/jars/springloaded-core-1.1.1.jar -Xverify:none

If Grails doesn't pick up the environment variable, replace ${GRAILS_HOME} with the full path to your Grails installation, like so:

-javaagent:/Users/kylewbanks/dev/grails-2.2.1/lib/org.springsource.springloaded/springloaded-core/jars/springloaded-core-1.1.1.jar -Xverify:none

I recommend reading about the -Xverify:none command before using it, and you can do so here. Essentially what it does is disable class verification, which can lead to some strange behaviour in some cases.

With this VM option set, you should be good to go!

Let me know if this post was helpful on Twitter @kylewbanks or down below!