0

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

我有这个例外:

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'. 

斑点虫.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")
    }
}
4

1 回答 1

3

需要添加spotbugsClasspath = buildscript.configurations.classpath

于 2018-06-25T07:51:28.993 回答