Please note this sentence from the documentation:
By using 'must run after" ordering rule you can specify that taskB must always run after taskA, whenever both taskA and taskB are scheduled for execution.
This means that
taskX.mustRunAfter packageApplication
doesn't make the taskX
run always after packageApplication
but just if you type:
./gradlew taskX packageApplication
On the other hand, it doesn't define a dependency, that is it doesn't automatically run taskX
task.
To do something, after a task is executed you can use the doLast
closure:
taskX.doLast{ println 'Hello' }
The packageApplication
is a property of the ApplicationVariant
class but not a task. The tasks are package<VariantName>
.