我正在尝试在我的build.gradle中添加校验样式。
which样式模板为commons-math3,可以从这里访问。
但是这个文件使用${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'
}但这是个错误。
将headerFile = rootProject.file("license-header.txt")从build.gradle中删除并使校验样式的Header模块被<!--和--> (即禁用)包装,使校验样式工作得很好。
如何在我的checkstyle.header.file文件中声明build.gradle?
发布于 2017-06-14 19:29:47
您需要在Gradle文件中定义属性:
checkstyle {
toolVersion '7.8.1';
configFile file('commons-math-checkstyle.xml');
configProperties 'checkstyle.header.file': file('license-header.txt');
}https://stackoverflow.com/questions/44551756
复制相似问题