Reputation: 5020
I use FindBugs for static code analysis in my Android projects. The setup is the following:
quality.gradle
plugins.apply('findbugs')
task findbugs(type: FindBugs) {
ignoreFailures = false
effort = 'max'
reportLevel = 'high' // Report only high priority problems.
classes = files("${project.projectDir}/build/intermediates/classes")
source = fileTree('src/main/java')
classpath = files()
reports {
xml.enabled = true
html.enabled = false
}
excludeFilter = rootProject.file('quality/findbugs.xml')
}
build.gradle:
subprojects {
afterEvaluate {
project.apply from: '../quality/quality.gradle'
tasks.findByName('findbugs').dependsOn('assemble')
tasks.findByName('check').dependsOn('findbugs')
}
}
But after I upgraded the Gradle Android Plugin from 3.1.3 to 3.2.0 the build started failing:
./gradlew clean build
> Task :app:findbugs FAILED
No files to be analyzed
...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:findbugs'.
> Failed to run Gradle FindBugs Worker
> Process 'Gradle FindBugs Worker 6' finished with non-zero exit value 1
Downgrading to 3.1.3 makes the build pass again. I haven't found anything related in the changelog of the Gradle Android Plugin. Can anybody point me out what's wrong with the plugin or my setup?
Upvotes: 6
Views: 2310
Reputation: 5020
After a short investigation, I found out that the location of Java class files has changed from build/intermediates/classes
to build/intermediates/javac
. The new FindBugs configuration:
task findbugs(type: FindBugs) {
...
classes = files("${project.projectDir}/build/intermediates/javac")
...
}
The strange thing that this breaking change isn't mentioned in the Android Gradle Plugin changelog, or in the Gradle changelog.
Upvotes: 16