I'm using maven spotless plugin to format java files, but it can't skip files. I used exclude
and toggle off
, neither works.
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.6.1</version>
<configuration>
<formats>
<format>
<!-- define the files to apply to -->
<includes>
<include>*.java</include>
</includes>
<excludes>
<exclude>api/**/RayCall.java</exclude>
<exclude>api/**/ActorCall.java</exclude>
<exclude>runtime/*/generated/**/*.*</exclude>
</excludes>
<!-- define the steps to apply to those files -->
<trimTrailingWhitespace/>
<endWithNewline/>
<indent>
<tabs>true</tabs>
<spacesPerTab>2</spacesPerTab>
</indent>
</format>
</formats>
<!-- define a language-specific format -->
<java>
<toggleOffOn>
<off>// Generated by `RayCallGenerator.java`. DO NOT EDIT.</off>
</toggleOffOn>
<googleJavaFormat>
<version>1.7</version>
<style>GOOGLE</style>
</googleJavaFormat>
</java>
</configuration>
</plugin>
Below is the working model. We have two packages for e.g. src/main/java/com/package1 and src/main/java/com/package2 And in below example we have excluded src/main/java/com/package1