Skip to content

Instantly share code, notes, and snippets.

@taichi
Last active December 17, 2015 02:09
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save taichi/5534057 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: configurations.compile.asPath)
}
},
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