Repository navigation
Add groupArtifact option to palantirJavaFormat - #3179
Merged
nedtwigg merged 5 commits intoNov 10, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a
groupArtifactoption toPalantirJavaFormatStep(spotless-lib),PalantirJavaFormatConfig(spotless-plugin-gradle), andPalantirJavaFormat(spotless-plugin-maven), bringingpalantirJavaFormatto parity withgoogleJavaFormat(#944) andcleanthat.Motivation & Use Cases
In #3084, a proposal to add a brand-new
openJavaFormatformatter step (~490 lines) was closed because a fork ofpalantir-java-formatis not differentiated enough to warrant its own separate top-level entry in the Spotless table of contents.However, Spotless already has a clean, idiomatic pattern for supporting binary-compatible forks or custom Maven coordinates without adding new entries to the table of contents: the
groupArtifactoption (as supported byGoogleJavaFormatStepsince #944 andCleanthatJavaStep).Currently,
PalantirJavaFormatStephardcodescom.palantir.javaformat:palantir-java-format, which prevents Maven and Gradle users from pointingpalantirJavaFormatat:dev.openjavaformat:open-java-format(21.0.2+), which is binary-compatible with Spotless's existingPalantirJavaFormatFormatterFuncglue (includingJavaFormatterOptions.Style.PALANTIR, restored in openjavaformat/open-java-format#200).palantir-java-formathosted under custom Maven coordinates.With this small change, users can seamlessly configure
open-java-format(or any binary-compatible fork) using the existingpalantirJavaFormatstep:Gradle:
spotless { java { palantirJavaFormat('21.0.2').groupArtifact('dev.openjavaformat:open-java-format') } }Maven:
Changes
lib: AddPalantirJavaFormatStep.defaultGroupArtifact()andPalantirJavaFormatStep.create(String groupArtifact, String version, String style, boolean formatJavadoc, Provisioner provisioner)withgroupId:artifactIdvalidation (matchingGoogleJavaFormatStep). KeepPalantirJavaFormatStep.MAVEN_COORDINATEintact for backwards compatibility.plugin-gradle: AddgroupArtifact(String)toJavaExtension.PalantirJavaFormatConfigand document inplugin-gradle/README.md.plugin-maven: Add@Parameter private String groupArtifacttoPalantirJavaFormatand document inplugin-maven/README.md.tests: Add unit and integration tests acrosstestlib,plugin-gradle, andplugin-maven(including formatting withdev.openjavaformat:open-java-format:21.0.2on JDK 21+ and testinggroupArtifactvalidation andSerializableEqualityTester).changelogs: UpdatedCHANGES.md,plugin-gradle/CHANGES.md, andplugin-maven/CHANGES.md.