java - SpotBugs "No value has been specified for property ' SpotbugsClasspath'"

标签 java android gradle findbugs spotbugs

我想在我的android项目中使用spotbugs,但它失败并出现异常。 运行任务:gradle->module->other->spotbugs

我有一个异常(exception):

FAILURE: Build failed with an exception.
    * What went wrong:
A problem was found with the configuration of task ':project:spotbugs'.
> No value has been specified for property 'spotbugsClasspath'. 

spotbugs.gradle

apply plugin: 'com.github.spotbugs'

buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath "gradle.plugin.com.github.spotbugs:spotbugs-gradle- plugin:1.6.2"
    }
}

spotbugs {
    toolVersion = "3.1.3"
    ignoreFailures = true
    effort = 'max'
    reportLevel = 'high'
    excludeFilter = file("$rootProject.projectDir/rules-findbugs.xml")
}

task spotbugs (type: com.github.spotbugs.SpotBugsTask) {
    println 'start spotbugs task'
    pluginClasspath = project.configurations.spotbugsPlugins
   // spotbugsClasspath = ???

    classes = fileTree("$project.buildDir/$classDir")
    source = fileTree("$project.projectDir/src/main/java/com/project/")
    classpath = files()

    reports {
        xml.enabled = false
        html.enabled = true
        html.destination = file("$project.buildDir/outputs/findbugs/findbugs.html")
    }
}

最佳答案

需要添加spotbugsClasspath = buildscript.configurations.classpath

关于java - SpotBugs "No value has been specified for property ' SpotbugsClasspath'",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50988333/

相关文章:

spring - IntelliJ runner 上的集成测试通过但在 gradle 上没有通过

java - Gradle 和 IntelliJ 混合 Java/Scala 项目和 SDK 1.6

java - 如何在单个命令行中输入两个值?

java - 如何使用for循环连续图像 slider ?

java - 从我的 Centos 7 服务器发送邮件不起作用

android - 我如何使用StreamBuilder而不出现这个轻微的null错误

android - 将图像保存在数据库中 erro & decodeByteArray give null

java - 从文件导入整数,将它们相乘,然后导出到新文件

Android - 带点的水平进度条

java - Gradle 不知道 Java 语法错误?