Grails 2.1.0 Not Auto-Reloading / Auto-Recompiling

Grails seems to automatically recompile my GSP pages, but not my controllers. He worked with a previous version of Grails. Any idea what I can find?

Using Grails 2.1.0 on Snow Leopard OSX.

Note. It looks like this problem

+7
source share
4 answers

If you name the package names on your controllers incorrectly (as in the folder structure it is not consistent with the package declaration), the application will still work and there will be no errors, but automatic reboot will not work.

+4
source

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

I found a couple of things that might be helpful.

Firstly, it seems like starting up a custom environment (which is not dev) disables automatic reloading ( https://stackoverflow.com/a/212510/167 ), so you will want to follow the directions in this post if you launch the application this way.

Secondly, if you use the application as a war, for sure autoload is disabled. ( See Grails auto-reload page )

Third, I found that using the Grails IDE (like IntelliJ or SpringSource) really adds more stability to the Grails development environment. For example, IntelliJ does not use the Grails shell file, which comes with binary download. It manually calls banks and Grails boot files.

My questions for you:

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

What Grails plugins have you installed (the Grails documentation says that the tomcat plugin is configured for optimal automatic reboots)?

Do you have any other Grails binaries downloaded to your computer (may cause confusion when downloading)?

And finally, can you reproduce this problem in a clean environment (what does the new Grails binary, the new Grails creation application mean)?

I also recommend reading the Deployment section of the Grails documentation ( found here ). It contains some information about rebooting.

I apologize for the long-awaited and potentially unanswered response, but I hope this triggered an idea or two. Let me know how it works!

+7
source

I had this problem when I had a BaseController class from which other controllers were derived. If I make changes to the BaseController class, such as adding a method or closing, changing the method name, importing some classes, etc., the whole function of reloading the class in Grails will stop.

The only solution that worked for me was to remove the target directory into which all the classes were compiled . At least I did not have to restart the server every time, which saved me from having to wait about 30 seconds to display the start page. This can be quite frustrating if the class reload function is not working properly.

The Grails auto-reload feature is not without quirks. Some of these quirks are ultimately related to java and how class loading works in a servlet container environment. I hope that the Grails team will make priority for the smooth reloading of classes for Grails, as in other scripting environments (ruby, PHP, python or play framework), because some other aspects of this structure are so nice to deal with.

0
source

Strange, I never had a problem with this. Are you sure your controllers compile correctly, no typos? I found that it usually takes just a couple of seconds to see the changes reflected in the controllers. Changes to domain objects require a reboot (they usually erase your stored data), and I found that sometimes a change in the managed spring resource (for example, in the injected service) fails. But the controllers and GSP pages recompile 97% of the time :)

I go between GGTS (eclipse) and the command line command line, and this almost always works for me. Perhaps you do some kind of caching? I am running JDK 1.6 on Lion, grails 2.1.1

Typically, you will see the output stating that the file was recompiled within a second or two beats.

-one
source

All Articles