如何使用groovy / gradle与指定的战争运行jetty 7+? [英] How to run jetty 7+ with specified war with groovy/gradle?
问题描述
我想用Gradle build来运行Jetty 7+,但看起来不像JettyRun那样做。因此,实现我想要的可能最简单的想法是使用自定义目标:
I want to run Jetty 7+ with gradle build, but unlucky looks like there is no way to do this with jettyRun. So probably simplest idea to achieve what I want would be to use custom target:
task runJetty << {
def server = new Server()
// more code here
server.start()
server.join()
}
不幸的是我刚开始使用gradle,我也不知道groovy,所以我很难创建适当的目标。我正在查看互联网,但我无法找到任何解决方案。
任何人都可以用一些示例groovy代码打我现有的码头jar吗?
Unlucky I just started with gradle and I don't know groovy either, so it's hard for me to create proper target. I was looking over the internet but I wasn't able to find any solution. Can anyone hit me with some sample groovy code which can run existing jar with jetty?
推荐答案
好吧,我发现直接从仓库使用jetty运行它:
Ok, I found out how to run it using jetty directly from repository:
jettyVersion = "8.1.0.RC0"
configurations {
jetty8
}
dependencies {
jetty8 "org.mortbay.jetty:jetty-runner:$jettyVersion"
}
task runJetty8(type: JavaExec) {
main = "org.mortbay.jetty.runner.Runner"
args = [war.archivePath]
classpath configurations.jetty8
}
这篇关于如何使用groovy / gradle与指定的战争运行jetty 7+?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!