我正在尝试创建自定义 spotbugs 任务来进行静态代码分析。因为它的大项目。在执行过程中,gradle 抛出一些错误并最终导致构建失败。
我的自定义任务:
apply plugin: "com.github.spotbugs-base"
task customSpotbugs (type: com.github.spotbugs.snom.SpotBugsTask) {
ignoreFailures = true
effort = "default"
reportLevel = "medium"
classes = files("$project.buildDir/intermediates/javac/dxRelease/compileDxReleaseJavaWithJavac/classes")
excludeFilter = file("$rootProject.rootDir/exclude.xml")
reports {
xml.enabled = false
html.enabled = true
html {
stylesheet = 'fancy-hist.xsl'
}
}
}
dependencies {
spotbugs 'com.github.spotbugs:spotbugs:4.0.0'
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.7.1'
}
错误:
The following classes needed for analysis were missing:
androidx.room.EntityDeletionOrUpdateAdapter
androidx.room.SharedSQLiteStatement
androidx.room.EntityInsertionAdapter
..........
> Task :Domain:customSpotbugs FAILED
:Domain:customSpotbugs (Thread[Execution worker for ':' Thread 8,5,main]) completed. Took 2 hrs 0 mins 12.064 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':Domain:customSpotbugs'.
> A failure occurred while executing com.github.spotbugs.snom.internal.SpotBugsRunnerForWorker$SpotBugsExecutor
> Verification failed: SpotBugs execution thrown exception
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.
由于这方面的文档很少,任何帮助将不胜感激..谢谢