FindBugs plugin not working

Viewed 2848

I am trying to add gradle FindBugs plugin to my android project. In my modules build.gradle file I add the following code.

apply plugin: 'findbugs'    
task findbugs(type: FindBugs) {
        ignoreFailures = false
        reportLevel = "medium"
        classes = files("${project.rootDir}/app/build/intermediates/classes")
        source = fileTree('src/main/java/')
        classpath = files()
        effort = "max"
    }

I have set the effort to max. But I keep getting this error message

Error:default|more|max]      set analysis effort level Error:Execution failed for task ':siddhi-android-platform:findbugs'.
> Failed to run Gradle FindBugs Worker
   > Process 'Gradle FindBugs Worker 5' finished with non-zero exit value 1

How can I solve this?

2 Answers

Try changing this line

classes = files("${project.rootDir}/app/build/intermediates/classes")

with

classes = files("${project.rootDir}/app/build/intermediates/javac")

For more explanation, see this ANSWER

Though I'm too late to answer this question.

You can run custom task by writing it as follows:-

task customFindBugs(type: FindBugs, dependsOn: 'test')

Currently, I'm searching for the best condition for findbugs to depend on but this will do the trick till then.

As soon as I find a solution, I will update this.

Edited: For findbugs you can create custom task as follows:-

task customFindBugsReport(type: FindBugs, dependsOn: 'check') {
ignoreFailures = true
excludeFilter = file("${project.rootDir}/tools/findbugs/rules-findbugs.xml")
classes = fileTree("${buildDir}/intermediates/classes/debug")
source = fileTree("${project.projectDir}/src/main/java")
classpath = files()

reports {
//Note only one report needs to be enabled, cannot enable more than one
        xml.enabled = false
        html.enabled = true
    }
}
Related