Skip to content

Commit ca812c1

Browse files
Use spotless / palantirJavaFormat - 2.56.0 for all JDKs
Spotless start using palantir-java-format 2.57.0 on Java 21 - on older jdks different versions are used. It causes a different code format depends on using JDK references: - diffplug/spotless#2447 - diffplug/spotless#2503 - palantir/palantir-java-format#1320 Additionally, we can't use older spotless on JDK8
1 parent 8e50079 commit ca812c1

File tree

1 file changed

+19
-28
lines changed

1 file changed

+19
-28
lines changed

pom.xml

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
<mojo.java.target>8</mojo.java.target>
180180
<maven.compiler.source>${mojo.java.target}</maven.compiler.source>
181181
<maven.compiler.target>${mojo.java.target}</maven.compiler.target>
182+
<maven.compiler.release>${mojo.java.target}</maven.compiler.release>
182183
<maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
183184

184185
<minimalJavaBuildVersion>${mojo.java.target}</minimalJavaBuildVersion>
@@ -235,6 +236,8 @@
235236
<versions-maven-plugin.version>2.18.0</versions-maven-plugin.version>
236237
<sisu-maven-plugin.version>0.9.0.M4</sisu-maven-plugin.version>
237238
<spotless-maven-plugin.version>2.44.5</spotless-maven-plugin.version>
239+
<!-- we use version 2.56.0 due to: https://github.com/palantir/palantir-java-format/issues/1320 -->
240+
<palantirJavaFormat.version>2.56.0</palantirJavaFormat.version>
238241
<project.build.outputTimestamp>2025-06-02T19:00:39Z</project.build.outputTimestamp>
239242
<!-- mono-module doesn't require site:stage for scm-publish -->
240243
<scmpublish.content>${project.reporting.outputDirectory}</scmpublish.content>
@@ -610,7 +613,11 @@
610613
<java>
611614
<!-- orders of used formatters are important -->
612615
<!-- eg. palantir override importOrder, so should be first -->
613-
<palantirJavaFormat />
616+
<palantirJavaFormat>
617+
<!-- Declare version so that spotless does not choose a version based on JDK version -->
618+
<!-- https://github.com/diffplug/spotless/issues/2503#issuecomment-2953146277 -->
619+
<version>${palantirJavaFormat.version}</version>
620+
</palantirJavaFormat>
614621
<removeUnusedImports />
615622
<importOrder>
616623
<order>javax,java,,\#</order>
@@ -711,19 +718,6 @@
711718
</execution>
712719
</executions>
713720
</plugin>
714-
<plugin>
715-
<groupId>com.diffplug.spotless</groupId>
716-
<artifactId>spotless-maven-plugin</artifactId>
717-
<executions>
718-
<execution>
719-
<id>spotless-check</id>
720-
<goals>
721-
<goal>check</goal>
722-
</goals>
723-
<phase>validate</phase>
724-
</execution>
725-
</executions>
726-
</plugin>
727721
<plugin>
728722
<groupId>org.apache.maven.plugins</groupId>
729723
<artifactId>maven-site-plugin</artifactId>
@@ -773,24 +767,21 @@
773767
</build>
774768

775769
<profiles>
776-
<profile>
777-
<id>jdk8</id>
778-
<activation>
779-
<jdk>[1.8,11)</jdk>
780-
</activation>
781-
<properties>
782-
<!-- last version working with java 8 -->
783-
<spotless-maven-plugin.version>2.30.0</spotless-maven-plugin.version>
784-
</properties>
785-
</profile>
786770
<profile>
787771
<id>java11+</id>
788772
<activation>
789-
<jdk>[11,)</jdk>
773+
<!-- TODO check support for JDK 25 after palantirJavaFormat upgraded -->
774+
<jdk>[11,25)</jdk>
790775
</activation>
791-
<properties>
792-
<maven.compiler.release>${mojo.java.target}</maven.compiler.release>
793-
</properties>
776+
<build>
777+
<!--- newer versions of plugins requires JDK 11 -->
778+
<plugins>
779+
<plugin>
780+
<groupId>com.diffplug.spotless</groupId>
781+
<artifactId>spotless-maven-plugin</artifactId>
782+
</plugin>
783+
</plugins>
784+
</build>
794785
</profile>
795786

796787
<profile>

0 commit comments

Comments
 (0)