【问题标题】:Android Studio checkstyle taskAndroid Studio checkstyle 任务
【发布时间】:2017-07-22 06:02:23
【问题描述】:

我有一个使用 checkstyle 任务的项目(多模块)。这是相关配置:

apply plugin: 'checkstyle'
check.dependsOn 'checkstyle'

// Set the directory for quality config files
def configDir = "${project.rootDir}/quality_tools"
// Set the directory for quality reports
def reportsDir = "${project.buildDir}/reports"

checkstyle {
    toolVersion = "7.6"

    configFile file("$configDir/checkstyle/google_checks.xml")
    configProperties.checkstyleSuppressionsPath = file("$configDir/checkstyle/suppressions.xml").absolutePath
}

@ParallelizableTask
class ParallelCheckstyle extends Checkstyle {}

task checkstyle(type: ParallelCheckstyle, group: 'verification') {
    description 'Runs Checkstyle inspection against Android sourcesets.'

    source 'src'
    include '**/*.java'
    exclude '**/gen/**'
    exclude '**/test/**'
    exclude '**/androidTest/**'
    exclude '**/R.java'
    exclude '**/BuildConfig.java'

    classpath = files()
}

这给了我以下错误:

任务 ':domain:checkstyle' 执行失败。 无法创建根模块:configLocation {[my_project_path]\quality_tools\checkstyle\google_checks.xml},类路径 {null}。

如果我将工具版本降级到 7.4,它似乎可以正常工作。 有没有办法让它与最新版本一起工作,或者如果我在配置中做错了什么,谁能告诉我?

谢谢。

【问题讨论】:

标签: android android-studio checkstyle


【解决方案1】:

似乎checkstyle 任务由于配置文件的属性而失败。 我已经更新到最新版本的google_checks.xm,现在可以正常使用了。

错误描述具有误导性。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-06-17
    • 1970-01-01
    • 2018-05-08
    • 2013-05-11
    • 2014-06-07
    • 2015-05-23
    • 2016-12-18
    • 2018-12-23
    相关资源
    最近更新 更多