Skip to content

Match Spotless POM self-closing style to maven-release-plugin output#356

Merged
khatchad merged 2 commits into
masterfrom
fix-566-sortpom-release-conflict
Jun 4, 2026
Merged

Match Spotless POM self-closing style to maven-release-plugin output#356
khatchad merged 2 commits into
masterfrom
fix-566-sortpom-release-conflict

Conversation

@khatchad

@khatchad khatchad commented Jun 3, 2026

Copy link
Copy Markdown
Member

Fixes the release-breaking Spotless conflict that forced 0.47.0 to be deployed manually (wala#566).

Problem

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/>). So every release commit was Spotless-dirty on the root POM. Pre-wala/ML#349 this was harmless (the ml-X.Y.Z tags failed the semver deploy gate and skipped deploy anyway, with post-hoc cleanup like c3d3d51e). After #349 pinned plain X.Y.Z tags, the tag-push build job fails at spotless:check and silently skips release-upload0.47.0 never 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 is sortPom'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's spaceBeforeCloseEmptyElement=true so 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 separate replaceRegex step (wala#535), since nothing rewrites them.

Verification

A release:prepare -DdryRun produces a tag POM that is formatting-identical to the Spotless-clean committed POM — the only differences are the <version> and scm <tag> values:

6c6
<   <version>0.47.1-SNAPSHOT</version>
> <version>0.99.0</version>
22c22
<     <tag>ml-0.45.0</tag>
> <tag>0.99.0</tag>

So a real release will pass the tag build's spotless:check and deploy without manual intervention.

Fixes wala#566.

`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>
Copilot AI review requested due to automatic review settings June 3, 2026 23:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 sortPom to emit spaced self-closing tags (<tag />) via spaceBeforeCloseEmptyElement=true.
  • Normalize existing self-closing tags in pom.xml to the spaced form to match the new formatter behavior.
  • Add explanatory documentation in pom.xml linking the change to the release failure scenario (wala#566).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pom.xml
@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.29%. Comparing base (d70fad6) to head (391b36b).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@khatchad khatchad enabled auto-merge June 3, 2026 23:48
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>
@khatchad khatchad added this pull request to the merge queue Jun 3, 2026
Merged via the queue into master with commit a9f5dbc Jun 4, 2026
13 checks passed
@khatchad khatchad deleted the fix-566-sortpom-release-conflict branch June 4, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spotless spaceless self-closing rule conflicts with maven-release-plugin's POM output, breaking release deploys

2 participants