1

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)

Charles
  • 50,943
  • 13
  • 104
  • 142
sherif
  • 2,282
  • 19
  • 21

1 Answers1

1

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.

Peter Niederwieser
  • 121,412
  • 21
  • 324
  • 259