I’m using the ANTLR plugin which generates files at the /build/generated-src/antlr/main/ directory. I want to exclude these files from the checkstyle plugin. I tried
tasks.withType(Checkstyle) {
exclude ‘build**’
}
to exclude everything inside the build directory, but it does not work. The documentation says:
Adds an ANT style exclude pattern.
I found this SO answer according to which I think my pattern above should work.
How can I exclude files from being analyzed by Checkstyle?
The exclude pattern is relative to the root folder (in this case the root folder is $buildDir/generated-src/antlr/main. You can’t use the root folder in the exclude pattern (this information is not visible to the exclude pattern)
Execution failed for task ‘:checkstyleMain’.
Cannot add include/exclude specs to Ant node. Only include/exclude patterns are currently supported.
See also this issue Unfortunately I’m not familiar with Groovy and don’t know how to apply the workaround mentioned at the bottom of this issue.
But since you said that the exclude pattern in this case is relative to $buildDir/generated-src/antlr/main I tried exclude '*' which works, but I’m not sure if this is a good solution and transferrable if I want to exclude other paths as well…?
Where can read more about how the root folder is constructed?