我已将 Gradle 构建脚本配置为使用 checkstyle 以及添加的 sventu checkstyle 检查,但是当我执行 checkstyleMain 任务时,构建失败并出现以下错误:
* What went wrong:
Execution failed for task ':checkstyleMain'.
> Unable to create a Checker: cannot initialize module TreeWalker - Unable to instantiate AvoidConstantAsFirstOperandInConditionCheck
即使我在构建中包含了 checkstyle jar,也会发生这种情况。以下是我的构建脚本的相关部分:
repositories {
mavenCentral()
maven {
url "http://sevntu-checkstyle.github.com/sevntu.checkstyle/maven2"
}
}
checkstyle {
configFile = new File("etc/config/dev.xml");
toolVersion = "6.8"
}
configurations {
checkstyle
}
dependencies {
checkstyle "com.github.sevntu.checkstyle:sevntu-checks:1.13.4"
}
请注意,当我删除依赖项部分并使用未配置额外 sevntu 检查的 checkstyle xml 文档进行测试时,构建工作正常。我的配置也类似于sevntu-checkstyle/checkstyle-samples 中的示例
我在这里想念什么?