我的项目正在使用spotless插件。我需要忽略generated-resources目录中的java文件。如何做同样的事情。
这就是我使用插件的方式。
apply plugin: "com.diffplug.gradle.spotless"
spotless {
lineEndings = 'unix';
java {
eclipseFormatFile "eclipse-java-google-style.xml"
}
}我不想删除包含在sourceSets中的generated-resources目录。
发布于 2017-09-08 19:41:37
您可以为允许包含和排除的无瑕疵格式化程序指定目标。
我在一个多项目构建的顶级build.gradle中使用了以下代码,其中所有Java代码都位于模块目录下的子目录中:
subprojects {
...
spotless {
java {
target project.fileTree(project.rootDir) {
include '**/*.java'
exclude 'modules/*/generated/**/*.*'
}
googleJavaFormat()
}
}
...
}https://stackoverflow.com/questions/41180662
复制相似问题