Skip to content

Commit 7e08339

Browse files
authored
Declare formatter version to avoid spotless choosing a version (#1151)
diffplug/spotless#2503 (comment) indicates that spotless chooses a formatter version based on the JDK running the formatting process. The spotless maintainer recommends that we declare a formatter version explicitly so that the formatter won't change based on the JDK version. Testing done: MAVEN_OPTS=-Djansi.force=true mvn -B -Dstyle.color=always -ntp clean verify In the winstone repository (where we saw the issue): Reverted the change that made the formatting independent of Java version in b95111923002d82598d4d85f67f40fa6170dda5e and then added explicit spotless version definition to the pom file so that I could confirm that changing Java versions does not change the formatting. MarkEWaite/winstone@78ea965 has the details . ~/bin/use_java17 mvn spotless:apply git status . ~/bin/use_java21 mvn spotless:apply git status
1 parent 40a14bd commit 7e08339

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

pom.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,11 @@
688688
<indent>
689689
<spaces>true</spaces>
690690
</indent>
691-
<palantirJavaFormat />
691+
<palantirJavaFormat>
692+
<!-- Declare version so that spotless does not choose a version based on JDK version -->
693+
<!-- https://github.com/diffplug/spotless/issues/2503#issuecomment-2953146277 -->
694+
<version>2.67.0</version>
695+
</palantirJavaFormat>
692696
<removeUnusedImports />
693697
<toggleOffOn />
694698
<trimTrailingWhitespace />

0 commit comments

Comments
 (0)