【问题标题】:Error:No value has been specified for property 'checkstyleClasspath'错误:没有为属性“checkstyleClasspath”指定值
【发布时间】:2018-03-01 05:08:05
【问题描述】:

为了检查所有子项目的代码风格。我创建了一个文件checkstyle.gradle 并将其应用于根目录中的build.gradle

apply plugin: 'checkstyle'


subprojects { project ->

    task checkstyle(type: Checkstyle) {
        configFile rootProject.file('checkstyle.xml')
        ignoreFailures false
        showViolations true
        classpath = files()
        source 'src/main/java'
    }

    // check code style after project evaluation
    afterEvaluate {
       project.tasks.findByName('checkstyle').execute()
    }
}

发生错误。

* 出了什么问题:
>配置项目 ':app' 时出现问题。
>发现任务':app:checkstyle'的配置有问题。
> 没有为属性“checkstyleClasspath”指定值。

我不知道为什么会发生错误。

【问题讨论】:

    标签: gradle android-gradle-plugin


    【解决方案1】:

    我只知道如何解决这个错误。

    subprojects { project ->
        apply plugin: 'checkstyle'
    
        task checkstyle(type: Checkstyle) {
            description 'Runs Checkstyle inspection against ICanPlayer sourcesets.'
            group = 'Code Quality'
            configFile rootProject.file('checkstyle.xml')
            ignoreFailures false
            showViolations true
            classpath = files()
            source 'src/main/java'
        }
    
        // check code style after project evaluation
        afterEvaluate {
            check.dependsOn('checkstyle')
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2014-08-20
      • 1970-01-01
      • 2015-08-01
      • 2019-09-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-21
      • 2019-10-06
      相关资源
      最近更新 更多