I'm trying to add checkstyle to my build.gradle
.
Checkstyle template is of commons-math3
, which can be accessed from here .
But this file uses ${checkstyle.header.file}
to check license declarations on the top of each source file.
<!-- Verify that EVERY source file has the appropriate license -->
<module name="Header">
<property name="headerFile" value="${checkstyle.header.file}"/>
</module>
So I added below phrase in my build.gradle
:
checkstyle {
configFile = rootProject.file("commons-math-checkstyle.xml")
headerFile = rootProject.file("license-header.txt")
toolVersion = '7.8.1'
}
but it makes an error.
Removing headerFile = rootProject.file("license-header.txt")
from build.gradle
and making Header
module in checkstyle xml file be wrapped by <!--
and -->
(ie disabling) makes checkstyle works well.
How can I declare checkstyle.header.file
in my build.gradle
file?
You need to define the property in your Gradle file:
checkstyle {
toolVersion '7.8.1';
configFile file('commons-math-checkstyle.xml');
configProperties 'checkstyle.header.file': file('license-header.txt');
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.