I recently upgraded my project.
spring boot: 2.1.6
gradle: 4.10.2
java version 11
jacoco : 0.8.1
checkstyle: 8.1
My project build fails and getting the error:
Task :checkstyleMain FAILED
.gradle\\daemon\\4.10.2\\etc\\checkstyle\\checkstyle-suppressions.xml (The system cannot find the path specified)
Here is my gradle build file:
jacoco {
toolVersion = '0.8.1'
}
jacocoTestReport {
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
'com/emp/contacts/domain',
'com/emp/MyApplication.class'
])
})
}
}
checkstyle {
toolVersion = '8.1'
configFile = new File(rootDir, 'etc/checkstyle/checkstyle.xml')
System.setProperty('checkstyle.cache.file', String.format('%s/%s',
buildDir, 'checkstyle.cachefile'))
}
Try to reference it alike this (these config XML can all be dropped into there):
configFile file("${project.rootDir}/config/checkstyle.xml")
The checkstyle-suppressions.xml
should be found when declaring an absolute path.
Finally I got it working. Thanks for the hint Martin.
There was a totally different strategy when using java 11
Gradle checkstyle plugin searches for suppressions.xml within the daemon folder when using Java 11
this post has helped me https://github.com/gradle/gradle/issues/8286
This is what I had to make in my project to make it work
In the build.gradle
checkstyle {
configDir = file("$rootProject.projectDir/etc/checkstyle")
}
In checkstyle.xml
<!-- Suppression file -->
<module name="SuppressionFilter">
<property name="file" value="${config_loc}/checkstyle-suppressions.xml"/>
</module>
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.