开发者

Pulling a gradle dependency jar from maven and then running it directly?

开发者 https://www.devze.com 2023-03-29 16:00 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消