有没有可能将 fb-contrib 库与 Gradle 的 FindBugs 插件 集成?我已经寻找解决方案一段时间了,但目前还没有找到任何可行的方法...
如果有帮助的话,这是我现在拥有的脚本。它还在不断完善中,但报告已经生成正确。
感谢您提前提供任何答案。
如果有帮助的话,这是我现在拥有的脚本。它还在不断完善中,但报告已经生成正确。
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
}
}
}
感谢您提前提供任何答案。
task findbugs(type: FindBugs) { toolVersion = "3.0.1" ... pluginClasspath = project.configurations.findbugsPlugins }
我会得到“No such property: toolVersion for class: org.gradle.api.plugins.quality.FindBugs_Decorated”的错误提示。 - KutzitoolVersion
不是一个任务属性。您需要使用findbugs { toolVersion = "3.0.1" }
全局定义该属性。请查看原始问题以获取示例。 - Johnco