PrakashFrancis
PrakashFrancis

Reputation: 191

Gradle depends on parallel execution

In Gradle, I need to run the tasks in parallel with dependsOn method

task testdepends(dependsOn: ['test1', 'test2']) {
    doLast {
        println("Final Task Completed!")
    }
}

In the above example I want to run the test1 and test2 in parallel.

Is there a way to achieve this ?

My basic need is - I have to run tasks in parallel. After the completion of the parallel tasks I have to run another task.

Upvotes: 4

Views: 2050

Answers (1)

Meursault
Meursault

Reputation: 77

Gradle runs inter-project tasks in parallel (wherever possible) if you use org.gradle.parallel=true or the --parallel flag. For intra-project tasks, you will need to use @ParallelizableTask for versions < 4 and Worker Api for versions >= 4.

However, be aware that WorkerApi has some limitations and is only useful in certain scenarios.

Upvotes: 2

Related Questions