torsdag 17 mars 2011

Grails script for running different environments

I have seen questions for how to do this, but it was really hard finding an answer, so I thought I might as well document it here.

As always, it´s really easy once you know how:


includeTargets << grailsScript("Init")

import org.codehaus.groovy.grails.cli.GrailsScriptRunner

target(main: "The description of the script goes here!") {
System.setProperty("grails.env", "wadl")
GrailsScriptRunner.main("test-app")
}

setDefaultTarget(main)