How to avoid Grails automatically rebuilding my project on every change?
I have an old Grails 1.1.1 project that I had to upgrade to version 1.3.5 with STS Pro.
As expected, some debris is floating around that may be causing issues, but I'm not sure that's causing the problem.
This is the problem: Every time I save a class (Java or Groovy), it automatically rebuilds the whole project and creates a war file.
Is this the normal behavior? Actually, I don't mind it that much, just because the build runs on the background. The problem is that the build some开发者_StackOverflow中文版times locks some resources temporarily, and I am having an annoying popup that says that it could not deploy because an assertion failed.
By the way, it doesn't say what was the assertion, so I have to click "OK" every time.
This is becoming a real pain.
Help will be greatly appreciated!
Thanks,
Luis
According to the reference documentation, you could do:
grails -Ddisable.auto.recompile=true run-app
However, you'll have to restart the application every time you make a change.
It looks like you are using the new feature (new to 2.5.1) to deploy your grails app to tc server, rather than calling grails run-app.
This is a new feature that we have just added and so it is still rough around the edges and may be rebuilding the war file when it is not entirely necessary. I'd recommend that you raise a jira issue for this: https://issuetracker.springsource.com/browse/STS
Andrew is probably right. I created a new Grails project from scratch, and executed the project using the command grails dev run-app (which can be run from STS).
I had no problems, and it behaved as expected: I was able to hot-deploy changes to my code, without regenerating and deploying a WAR file. Unfortunately, the console in STS does not show when it has finished compiling and the web-app is ready, so I have to wait a little bit before refreshing my browser.
I'm having the same issue calling grails run-app. STS is triggering the WAR build each time, so although I can access my changes instantly in the browser, STS starts chewing CPU cycles & pausing while it rebuilds. I can't help saving often. I grew up playing space quest so it's been habit for a long long time.
精彩评论