Last active
December 17, 2015 02:09
-
-
Save taichi/5534057 to your computer and use it in GitHub Desktop.
run jetty9 on gradle. http://issues.gradle.org/browse/GRADLE-1956
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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