【发布时间】: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,它似乎可以正常工作。 有没有办法让它与最新版本一起工作,或者如果我在配置中做错了什么,谁能告诉我?
谢谢。
【问题讨论】:
-
我已经用最新版本更新了
google_checks,它现在似乎可以工作了。我正在使用这里的样式:github.com/checkstyle/checkstyle/blob/master/src/main/resources/… 该错误具有误导性,似乎某些属性不再受支持(或已被替换)。
标签: android android-studio checkstyle