Is there a way how to specify system property in (already started) grails interactive mode ?
For example I would specify environment in command line:
grails开发者_如何学Go -Dgrails.env=staging run-app
but in interactive mode it is not possible this way (since JVM is already started):
grails
grails> -Dgrails.env=staging run-app
This seems to work in Grails 1.3.7 interactive mode. Add a script to your Grails application at scripts/SetProperty.groovy
:
includeTargets << grailsScript('_GrailsArgParsing')
target (default:'Set a system property') {
depends('parseArguments')
if (argsMap['params'][0] && argsMap['params'][1]) {
System.setProperty(argsMap['params'][0], argsMap['params'][1])
} else {
println 'You must define a property to set'
}
}
Then in interactive mode set-property grails.env staging
.
精彩评论