【发布时间】:2017-06-14 18:06:31
【问题描述】:
我正在尝试将 checkstyle 添加到我的 build.gradle。
Checkstyle模板为commons-math3,可从here访问。
但此文件使用${checkstyle.header.file} 来检查每个源文件顶部的许可证声明。
<!-- Verify that EVERY source file has the appropriate license -->
<module name="Header">
<property name="headerFile" value="${checkstyle.header.file}"/>
</module>
所以我在build.gradle 中添加了以下短语:
checkstyle {
configFile = rootProject.file("commons-math-checkstyle.xml")
headerFile = rootProject.file("license-header.txt")
toolVersion = '7.8.1'
}
但它会出错。
从build.gradle 中删除headerFile = rootProject.file("license-header.txt") 并使checkstyle xml 文件中的Header 模块被<!-- 和--> 包装(即禁用)使得checkstyle 工作良好。
如何在我的build.gradle 文件中声明checkstyle.header.file?
【问题讨论】:
标签: gradle checkstyle