17Sep/080
Running Grails in custom Environment
This took me quite a while to figure out yesterday, so I just have to document it here. Grails sports three environments per default: development, testing and production. To create a testing WAR file you simply type this:
grails test war
Everything is fine when you stick to them. But if you created another environment, e.g. "foo", the same line wont work anymore:
grails foo war
Welcome to Grails 1.0.3 - http://grails.org/ Licensed under Apache Standard License 2.0 Grails home is set to: /home/jakob/grails-1.0.3
Base Directory: /home/jakob/workspace/fooproject Script Foo not found. Run 'grails help' for a complete list of available scripts.
This is annoying but easy to solve. All you have to do is to provide the name of the environment as a variable:
grails -Dgrails.env=foo war
Thats it.
