Match Spotless POM self-closing style to maven-release-plugin output#356
Merged
Conversation
`maven-release-plugin` re-serializes POMs with the spaced self-closing form (`<tag />`) during `release:prepare`, but Spotless's `sortPom` enforced the spaceless form (`<tag/>`). Every release commit was therefore Spotless-dirty on the root POM. Pre-wala/ML#349 this was harmless (artifactId-prefixed tags failed the semver deploy gate and skipped deploy); after #349 pinned plain `X.Y.Z` tags, the tag-push `build` job fails at `spotless:check` and silently skips the deploy — 0.47.0 had to be deployed manually. Set `sortPom`'s `spaceBeforeCloseEmptyElement=true` so Spotless enforces the same spaced form the release plugin emits. Release commits are now clean from the start, with no post-release `spotless:apply` or manual deploy. Only POMs adopt the spaced form; the summary XMLs (`tensorflow.xml`, etc.) stay spaceless via the separate `replaceRegex` step (wala#535), since nothing rewrites them. This was not, as wala#351 assumed, the same conflict #351 addressed: POMs are already excluded from #351's `replaceRegex`. The POM conflict is `sortPom`'s. Fixes wala#566. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Aligns Spotless POM formatting with maven-release-plugin’s POM serialization so release:prepare no longer produces release commits that immediately fail spotless:check, unblocking CI-driven releases.
Changes:
- Configure Spotless
sortPomto emit spaced self-closing tags (<tag />) viaspaceBeforeCloseEmptyElement=true. - Normalize existing self-closing tags in
pom.xmlto the spaced form to match the new formatter behavior. - Add explanatory documentation in
pom.xmllinking the change to the release failure scenario (wala#566).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #356 +/- ##
=========================================
Coverage 71.29% 71.29%
Complexity 2674 2674
=========================================
Files 270 270
Lines 20152 20152
Branches 3257 3257
=========================================
Hits 14367 14367
Misses 4487 4487
Partials 1298 1298 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The `replaceRegex` comment claimed the spaceless form matches the POM sortpom style and `maven-release-plugin` output. With this PR, POMs use the spaced form; the spaceless rule applies only to the summary XMLs. Flagged by Copilot. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Fixes the release-breaking Spotless conflict that forced 0.47.0 to be deployed manually (wala#566).
Problem
maven-release-pluginre-serializes POMs with the spaced self-closing form (<tag />) duringrelease:prepare, but Spotless'ssortPomenforced the spaceless form (<tag/>). So every release commit was Spotless-dirty on the root POM. Pre-wala/ML#349 this was harmless (theml-X.Y.Ztags failed the semver deploy gate and skipped deploy anyway, with post-hoc cleanup likec3d3d51e). After #349 pinned plainX.Y.Ztags, the tag-pushbuildjob fails atspotless:checkand silently skipsrelease-upload—0.47.0never published via CI and had to be deployed by hand.Note this is not the conflict wala#351 addressed: POMs are already excluded from #351's
replaceRegex. The POM conflict issortPom's, and #351's premise that the spaceless form "matches the maven-release-plugin output" was incorrect — the plugin emits the spaced form.Fix
Set
sortPom'sspaceBeforeCloseEmptyElement=trueso Spotless enforces the same spaced form the release plugin emits. Release commits are now clean from the start. Only POMs adopt the spaced form; the summary XMLs (tensorflow.xml, etc.) stay spaceless via the separatereplaceRegexstep (wala#535), since nothing rewrites them.Verification
A
release:prepare -DdryRunproduces a tag POM that is formatting-identical to the Spotless-clean committed POM — the only differences are the<version>and scm<tag>values:So a real release will pass the tag
build'sspotless:checkand deploy without manual intervention.Fixes wala#566.