我想获得通过 Gradle 运行 Checkstyle 的输出作为 HTML 报告。
我在其中什么也没找到Checkstyle插件文档 http://www.gradle.org/docs/current/dsl/org.gradle.api.plugins.quality.Checkstyle.html.
我已将以下内容添加到我的build.gradle
file.
checkstyleTask {
reports {
html {
destination "build/reports/checkstyle.html"
}
}
}
但这产生了
出了什么问题:评估根项目“MyProject”时出现问题。
在根目录上找不到参数 [build_1vu33nc0ekgtoo19jt e86o8o42$_run_closure8@1d8ee20] 的方法 checkstyleTask()
项目“我的项目”。
有没有办法使用 Gradle 生成 Checkstyle HTML 报告?
Thanks.
以下是我在一个小项目中的做法:
checkstyleMain << {
ant.xslt(in: reports.xml.destination,
style: new File('config/checkstyle-noframes-sorted.xsl'),
out: new File(reports.xml.destination.parent, 'main.html'))
}
这要求您将 checkstyle-noframes-sorted.xsl 文件存储在 checksyle 二进制发行版的 contrib 目录中config
您的项目的目录。
如果您有能力运行 SonarQube 服务器,那么使用声纳插件会带来更好的用户体验。
编辑:如果存在违规,上述内容将不起作用。在所有情况下这都应该:
task checkstyleHtml << {
ant.xslt(in: checkstyleMain.reports.xml.destination,
style: file('/config/checkstyle-noframes-sorted.xsl'),
out: new File(checkstyleMain.reports.xml.destination.parent, 'main.html'))
}
checkstyleMain.finalizedBy checkstyleHtml
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)