Using fb-contrib library with Gradle FindBugs plugin

Is it possible to integrate the fb-contrib library with the Gradle FindBugs plugin ? I was looking for some solution for a while, but so far I have not found anything ...

If that helps, here I have a script right now. This is 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 response.

+7
gradle findbugs
source share
2 answers

I just stumbled upon the 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 this helps!

You can add Findbugs plugins by simply adding them depending on findbugsPlugins

+6
source share

if you put the fb-contrib.jar file in the Findbugs plugins directory, it should just automatically access, I think. Never tried Gradle tho.

+3
source share

All Articles