Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails 2.1.0 Not Auto-Reloading / Auto-Recompiling

Tags:

java

grails

Seems that Grails does automatically recompile my GSP pages, but not my controllers. It used to work with the previous version of Grails. Any idea what I can look for?

Using Grails 2.1.0 on OSX Snow Leopard.

Note: This is similar to this issue

like image 364
sparkyspider Avatar asked Aug 24 '12 21:08

sparkyspider


2 Answers

Disclaimer: Auto-reload has always worked for me on my Mac.

I've found a couple of things that might be useful.

First, it appears that running a custom environment (that isn't dev) disables auto-reload (see this stackoverflow post), so you'll want to follow the directions in that post if you're running the application that way.

Second, if you're running the app as a war, for sure auto-reload is turned off. (See the Grails Auto-Reload Page)

Third, I've found that using a Grails IDE (such as IntelliJ or SpringSource) really adds a lot of stability to the Grails development environment. For example, IntelliJ doesn't use the Grails shell file that comes with the binary download. It manually invokes the Grails jars and bootstraps.

My questions to you are:

What does the rest of your environment look like? How are you running your application (run-app or another container)?

What Grails plugins do you have installed (the Grails documentation says the tomcat plugin is configured for optimal auto-reloading)?

Do you have any other Grails binaries downloaded on your computer (could cause confusion when it's trying to load)?

And finally, are you able to reproduce this issue in a clean environment (meaning new Grails binary, fresh Grails create-app)?

I'd also recommend reading the Deployment section of the Grails documentation (found here). It has some pertinent information regarding the reloading.

I apologize for the longwinded and potentially non-answering answer, but I hope this has sparked an idea or two. Let me know how things turn out!

like image 133
Jonathan Larson Avatar answered Nov 09 '22 04:11

Jonathan Larson


If you name the package names on your controllers incorrectly (as in the folder structure does not agree with the package declaration), the application will still run and no errors will be reported, but auto-reloading will not work.

like image 33
sparkyspider Avatar answered Nov 09 '22 06:11

sparkyspider