Skip to content

Instantly share code, notes, and snippets.

@chilicat
Last active January 18, 2018 20:20
Show Gist options
  • Save chilicat/5187398 to your computer and use it in GitHub Desktop.
Save chilicat/5187398 to your computer and use it in GitHub Desktop.
Gradle Findbugs: This gradle script will disable findbugs until "findbugs" task is in the task graph. This allows to skip the findbugs verification for cases it is not needed.
allprojects {
// Marker Task to enable findbugs.
task findbugs(
group: "Verification",
description: """Marker task to enabled findbugs. Findbugs is by default
disabled. E.g. ( ./gradlew findbugs build )"""
)
}
subprojects {
apply plugin: 'findbugs'
findbugs {
// your findbugs configuration.
ignoreFailures = true
}
gradle.taskGraph.whenReady { taskGraph ->
tasks.findbugsMain.onlyIf { taskGraph.hasTask((tasks.findbugs)) }
tasks.findbugsTest.onlyIf { taskGraph.hasTask((tasks.findbugs)) }
}
}
@sleroy
Copy link

sleroy commented Sep 17, 2014

Working perfectly thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment