Pulling a gradle dependency jar from maven and then running it directly?
Is there a way in gradle to specify a dependency (a jar), and then run t开发者_高级运维hat jarfile directly within a task?
Here is one way:
configurations {
tool
}
dependencies {
tool "some:tool:1.0"
}
task runTool(type: JavaExec) {
main = "some.tool.Main"
classpath configurations.tool
}
If you don't know the main class and/or want to do the equivalent of java -jar
, you need to employ a workaround as described in http://issues.gradle.org/browse/GRADLE-1274.
精彩评论