Hi,
I use a custom task to copy the checkstyle.xml file from a dependcy JAR into the config/checkstyle directory.
The checkstyle.xml is valid and when I remove the custom task from build.gradle and run checkstyleMain everything works as expected.
But with the custom task Checkstyle is behaving strange: The ImportControl module runs amok and classifies hundreds of imports as disallowed.
The same config file is processed fine when I pass it to checkstyle on the command line.
I think that the custom task is somehow messing with the Checkstyle Plugin config.
Here is the relevant build.gradle snippet:
dependencies {
checkstyle configurations.checkstyleDependency.dependencies
checkstyleDependency group: 'com.xxx.yyy', name: 'yyy-commons', version: '0.0.3-SNAPSHOT'
}
configurations {
checkstyleDependency
}
task extractCheckstyleDependency(type: Copy, dependsOn: configurations.checkstyleDependency) {
from zipTree(configurations.checkstyleDependency[0]), {include "checkstyle/*"}
into 'config/checkstyle'
eachFile {
f -> f.path = f.path.replaceFirst('checkstyle/', '')
}
includeEmptyDirs false
}
checkstyle {
toolVersion = "8.7"
maxWarnings = 0
}
tasks.withType(Checkstyle) {
dependsOn extractCheckstyleDependency
reports {
xml.enabled true // needed by jenkins
html.enabled true
}
}