How to override default Grails environment?

environment-variables, grails, overriding

Solution

However I was wondering if it is possible (and if so, how) to override development as the default

No, this is not possible. Incidentally, the default environment depends on the command, e.g.

- the default environment for `run-app` is `development`

- the default environment for `test-app` is `test`

- the default environment for `war` is `production`

Problem

Grails allows you to define different "environments" for your app inside `Config.groovy` like so: ``` environments { development { ... } demo { ... } production { ... } } ``` Thus you can run your app like so: ``` grails -Dgrails.env=demo run-app ``` ...and Grails will run your app in "demo" environment mode. The default is `development`, so if you just execute: ``` grails run-app ``` ...it's the same as: ``` grails -Dgrails.env=development run-app ``` However I was wondering if it is possible (and if so, how) to override `development` as the default and make it, say, `demo`? Such that: ``` grails run-app ``` ...is equivalent to: ``` grails -Dgrails.env=demo run-app ``` Thoughts?

Original source