我正在尝试从默认的 checkstyle 配置 sun-checks 切换到 google-checks。
在我的 jenkinsfile 中,我写道:
stage('checkstyle') {
steps {
sh "mvn clean checkstyle:checkstyle -Dcheckstyle.config.location='https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml'"
checkstyle canComputeNew: false, defaultEncoding: '', healthy: '', pattern: 'target/checkstyle-result.xml', unHealthy: ''
}
}
这是失败的错误消息
无法在项目 pmm 上执行目标 org.apache.maven.plugins:maven-checkstyle-plugin:2.17:checkstyle (default-cli):Checkstyle 报告生成中发生错误。:在 checkstyle 执行期间失败:在 checkstyle 配置期间失败:无法解析配置流 - 必须声明元素类型“html”。:8:17 -> [帮助 1]
如何更改 Jenkins 的 checkstyle 配置?
https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
首先,您给它一个 HTML 文档而不是 XML 文件。您必须使用 github原始文件的 URL 。
示例:https : //raw.githubusercontent.com/checkstyle/checkstyle/master/src/main/resources/google_checks.xml
其次,您不应使用 google_checks 的在线 SNAPSHOT 版本。请参阅https://stackoverflow.com/a/44060396/1016482了解原因。
如何更改 Jenkins 的 checkstyle 配置?
提取在 checkstyle JAR 中找到的配置(如果您要更改它),并让您的 maven 命令使用它。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句