sherif
sherif

Reputation: 2332

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)

Upvotes: 1

Views: 924

Answers (1)

Peter Niederwieser
Peter Niederwieser

Reputation: 123996

As of Gradle 1.9, Gradle can only run task from different projects in parallel. You can implement your own task and execute the main methods in parallel within that task, possibly using the Project.javaexec() method. However, you'll have to implement this yourself, for example with the GPars library.

Upvotes: 1

Related Questions