Skip to content

Instantly share code, notes, and snippets.

@dai0304
Forked from taichi/deploy2jetty9.gradle
Last active December 22, 2015 00:19
Show Gist options
  • Save dai0304/6388289 to your computer and use it in GitHub Desktop.
Save dai0304/6388289 to your computer and use it in GitHub Desktop.
apply plugin: 'war'
configurations { jetty9 }
dependencies.jetty9 'org.eclipse.jetty:jetty-ant:9.0.2.v20130417'
ant {
taskdef(name: 'jettyRun', classname: 'org.eclipse.jetty.ant.JettyRunTask', classpath: configurations.jetty9.asPath)
taskdef(name: 'jettyStop', classname: 'org.eclipse.jetty.ant.JettyStopTask', classpath: configurations.jetty9.asPath)
}
def config = [
contextPath : '/',
port : 8080,
stopPort : 9999,
stopKey : 9999
]
[
task(jettyRun) << {
ant.jettyRun(jettyPort: config.port, scanIntervalSeconds: 3) {
webApp(war: webAppDir, contextPath: config.contextPath, extraClasspath: org.gradle.util.CollectionUtils.join(',', configurations.compile.files))
}
},
task(jettyRunWar(dependsOn: war)) << {
ant.jettyRun(jettyPort: config.port) {
webApp(war: war.archivePath, contextPath: config.contextPath)
}
},
task (jettyStart(dependsOn: war)) << {
ant.jettyRun(daemon: true, jettyPort: config.port, stopPort: config.stopPort, stopKey: config.stopKey) {
webApp(war: war.archivePath, contextPath: config.contextPath)
}
},
task(jettyStop) << {
ant.jettyStop(stopWait: 1, stopPort: config.stopPort, stopKey: config.stopKey)
}
].each { it.group = 'jetty9' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment