I want to use google style checks with gradle checkstyle(v8.42) plugin.
Is google_checks.xml available in plugin or configuration should be copied from https://github.com/checkstyle/checkstyle/blob/checkstyle-8.42/src/main/resources/google_checks.xml?
The google_checks.xml
is part of the published Checkstyle JAR:
So you can use Gradle to retrieve the resource from the JAR.
The below will work. In the Kotlin DSL:
// build.gradle.kts
plugins {
id("java")
id("checkstyle")
}
checkstyle {
val archive = configurations.checkstyle.get().resolve().filter {
it.name.startsWith("checkstyle")
}
config = resources.text.fromArchiveEntry(archive, "google_checks.xml")
}
Checkstyle block in the Groovy DSL:
def archive = configurations.checkstyle.resolve().find {
it.name.startsWith("checkstyle")
}
config = resources.text.fromArchiveEntry(archive, "google_checks.xml")