简体   繁体   English

摇篮一次运行多个罐子

[英]Gradle run multiple jars at once

This code executes each run task one at a the time 该代码一次执行一个运行任务

...
task run1 (type: JavaExec, dependsOn: classes) {
    main="com.package.Main1"
    classpath sourceSets.main.output.classesDir
    classpath configurations.compile
}
...

task runAll(){
    dependsOn run1
    dependsOn run2
    dependsOn run3
        ...

}
...

How can I run multiple Main classes from one jar file at once (parallel) 如何一次从一个jar文件中运行多个Main类(并行)

As of Gradle 1.9, Gradle can only run task from different projects in parallel. 从Gradle 1.9开始,Gradle只能并行运行来自不同项目的任务。 You can implement your own task and execute the main methods in parallel within that task, possibly using the Project.javaexec() method. 您可以实现自己的任务并该任务中并行执行主要方法,可能使用Project.javaexec()方法。 However, you'll have to implement this yourself, for example with the GPars library. 但是,您必须自己实现此功能,例如使用GPars库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM