Skip to content

Instantly share code, notes, and snippets.

@xlson
Created November 11, 2010 14:39
Show Gist options
  • Save xlson/672577 to your computer and use it in GitHub Desktop.
Save xlson/672577 to your computer and use it in GitHub Desktop.
Quick hack that makes it easier to use the tomcat plugins deploy feature.
includeTargets << grailsScript("Init")
def tomcatRedeploy(String environment) {
runTomcatTarget('undeploy', environment)
runTomcatTarget('deploy', environment)
}
def runTomcatTarget(String target, String environment) {
def proc = ['grails', "-Dgrails.env=$environment", 'tomcat', target].execute()
proc.consumeProcessOutput System.out, System.err
proc.waitFor()
}
target(main: "Do a redeploy using the tomcat plugin.") {
depends(parseArguments)
def env = argsMap.params ? argsMap.params[0] : 'stage'
tomcatRedeploy(env)
}
setDefaultTarget("main")
@xlson
Copy link
Author

xlson commented Nov 11, 2010

Quick hack that acts as an alias for grails -Dgrails.env=$env tomcat undeploy && grails -Dgrails.env=$env tomcat deploy. Instead you will be able to call grails deploy (deploy to stage) or grails deploy env (deploy to the chosen environment). Put the file into $PROJECT_DIR/scripts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment