We decided to integrate Checkstyle as a static analysis tool into the build system of our projects. Initially, we used the configuration for ‘Google Java Style’ that comes out of the box:
checkstyle {
val archive = configurations.checkstyle.get().resolve().filter {
it.name.startsWith("checkstyle")
}
config = resources.text.fromArchiveEntry(archive, "google_checks.xml")
}
Now, we would like to modify some rules, which requires creating a custom XML document. As the same rules have to be used across all projects, I would like to avoid maintaining the same XML document in multiple places.
The first idea I had was to package the document in a JAR, but I couldn’t figure out how to configure checkstyle
to read the configuration from the JAR. Any ideas?