Add spotless plugin (#2537)

* Adds the `spotless` plugin

* Excludes `Java17` files

Excludes:
- Java17RecordTest.java
- Java17RecordReflectionTest.java

* Fixes formatting in `pom.xml`
This commit is contained in:
Maicol 2023-11-13 17:27:44 +01:00 committed by GitHub
parent c2a0e4634a
commit d58e2c9382
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

43
pom.xml
View File

@ -124,6 +124,49 @@
</execution>
</executions>
</plugin>
<!-- Spotless plugin: keeps the code formatted following the google-java-styleguide -->
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.40.0</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<formats>
<format>
<includes>
<include>*.md</include>
<include>.gitignore</include>
</includes>
<trimTrailingWhitespace/>
<endWithNewline/>
<indent>
<spaces>true</spaces>
<spacesPerTab>4</spacesPerTab>
</indent>
</format>
</formats>
<java>
<excludes>
<exclude>src/test/java/com/google/gson/functional/Java17RecordTest.java</exclude>
<exclude>src/test/java/com/google/gson/native_test/Java17RecordReflectionTest.java</exclude>
</excludes>
<googleJavaFormat>
<style>GOOGLE</style>
<reflowLongStrings>true</reflowLongStrings>
<formatJavadoc>true</formatJavadoc>
</googleJavaFormat>
<importOrder/>
<removeUnusedImports/>
<formatAnnotations/> <!-- Puts type annotations immediately before types. -->.
</java>
</configuration>
</plugin>
</plugins>
<pluginManagement>