我在Android项目中使用FindBugs进行静态代码分析。设置如下:
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')
}
}
但是我将Gradle Android插件从3.1.3升级到3.2.0后,构建开始失败:
./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
降级到3.1.3使构建再次通过。我没有在Gradle Android插件的changelog中找到任何相关内容。有人可以指出插件或设置的问题吗?