Is it possible to integrate the fb-contrib library with Gradle's FindBugs plugin? I've been looking around for a solution for a while but so far I haven't found anything...
If it helps, here's the script I have right now. It's a work in progress but the report is generated correctly.
apply plugin: "findbugs"
task findbugs(type: FindBugs) {
classes = fileTree(project.rootDir.absolutePath).include("**/*.class");
source = fileTree(project.rootDir.absolutePath).include("**/*.java");
classpath = files()
findbugs {
toolVersion = "2.0.3"
ignoreFailures = true
effort = "max"
reportLevel = "low"
reportsDir = file("${projectDir}/reports/findbugs")
sourceSets = [it.sourceSets.main, it.sourceSets.test]
}
tasks.withType(FindBugs) {
reports {
xml.enabled = false
html.enabled = true
}
}
}
Thanks in advance for any answer.
I just came across this very same problem. I was able to solve it as follows:
apply plugin: 'findbugs'
dependencies {
// We need to manually set this first, or the plugin is not loaded
findbugs 'com.google.code.findbugs:findbugs:3.0.0'
findbugs configurations.findbugsPlugins.dependencies
// To keep everything tidy, we set these apart
findbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:6.0.0'
}
task findbugs(type: FindBugs) {
// Add all your config here ...
pluginClasspath = project.configurations.findbugsPlugins
}
Hope that helps!
You can add more Findbugs plugins just by adding them under dependencies for findbugsPlugins
if you place the fb-contrib.jar in Findbugs' plugin directory, it should just automagically get picked up, i would think. Never tried with Gradle tho.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With