ewok
ewok

Reputation: 21453

gradle: for taskB to run after taskA whenever taskA is run

I'm having trouble figuring out how to force a task to always run after another one. I'm aware of dependsOn, but taskA.dependsOn taskB will cause taskB to execute first. I'm also aware of mustRunAfter and shouldRunAfter, but taskB.mustRunAfter taskA does not force taskB to run, it only ensures that IF both are called, taskA runs first. IF I use both, I get a circular dependency error.

I want gradle taskA to cause taskA to run, then taskB to run.

Upvotes: 0

Views: 807

Answers (1)

ewok
ewok

Reputation: 21453

I was looking for finalizer tasks. Use the method finalizedBy():

taskA.finalizedBy taskB

Upvotes: 1

Related Questions