问题
When using Eclipse for your Grails projects the building of the war seems to be stuck in production mode.
If you want to deploy to an attached tcServer you simply right click on your project then choose “run as” ->“run on server”.
If you have your grails project set to “dev” (right click on your project then choose “properties”->”grails”->”run on server”) then you would expect the project to build a development war. You’d be wrong. You get a production build.
How do you get a eclipse to build a development war?
回答1:
Each Grails command has a default environment, e.g.
- grails run-app => dev
- grails test-app => test
- grails war => production
You can override this default by supplying an argument -Dgrails.env=<environment>
. So to build a war for the dev environment, run grails -Dgrails.env=dev war
回答2:
Don, What you say is correct for the command line. I'm referring to Eclipse.
I have solved the problem.
It seems there is a bug in Eclipse. If you want your app built (through Eclipse) as development then set the “dev” to “test”.
As it stands with you cannot get Eclipse to build a dev war. The version of eclipse I am using is Version: Indigo Service Release 1 Build id: 20110916-0149.
来源:https://stackoverflow.com/questions/8910418/in-eclipse-spring-source-grails-always-build-in-production-mode