Checkstyle gradle 使用 google 检查
Checkstyle gradle use google checks
我想通过 gradle checkstyle(v8.42) 插件使用 google 样式检查。
google_checks.xml 是否在插件中可用,或者应该从 https://github.com/checkstyle/checkstyle/blob/checkstyle-8.42/src/main/resources/google_checks.xml 复制配置?
google_checks.xml
是已发布的 Checkstyle JAR 的一部分:
因此您可以使用 Gradle 从 JAR 中检索资源。
以下将起作用。它是用 Kotlin DSL 编写的,但可以轻松转换为 Groovy 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")
}
我想通过 gradle checkstyle(v8.42) 插件使用 google 样式检查。
google_checks.xml 是否在插件中可用,或者应该从 https://github.com/checkstyle/checkstyle/blob/checkstyle-8.42/src/main/resources/google_checks.xml 复制配置?
google_checks.xml
是已发布的 Checkstyle JAR 的一部分:
因此您可以使用 Gradle 从 JAR 中检索资源。
以下将起作用。它是用 Kotlin DSL 编写的,但可以轻松转换为 Groovy 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")
}