Skip to content

Instantly share code, notes, and snippets.

@devniel
Created December 27, 2022 12:53
Show Gist options
  • Save devniel/6ec010ddfb76457dd32aeac2a9e87b91 to your computer and use it in GitHub Desktop.
Save devniel/6ec010ddfb76457dd32aeac2a9e87b91 to your computer and use it in GitHub Desktop.
Excluding a task [gradle]
// Excluding a task
task1 {
dependsOn taskChain
// it will only disable task3
// but not its dependencies
task3.enabled = false
}
task2 {
// it will override task1 test.enabled config
task3.enabled = true
}
task2 {
doLast {
// ignored
task3.enabled = true
}
}
// Alternative 1
task3.onlyIf { project.hasProperty('withTask3') }
// Alternative 2
// From outside
./gradlew task1 -x task3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment