Skip to content

chore: standardize POM formatting with Spotless SortPom - #5702

Open
shalk wants to merge 2 commits into
apolloconfig:masterfrom
shalk:chore/spotless-sortpom
Open

shalk wants to merge 2 commits into
apolloconfig:masterfrom
shalk:chore/spotless-sortpom

Conversation

@shalk

@shalk shalk commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What's the purpose of this PR

Extend Apollo's existing Spotless formatting and CI check to Maven POM files, providing a shared baseline instead of IDE-specific indentation, wrapping, and element ordering.

Which issue(s) this PR fixes:

Fixes #5701

Brief changelog

  • Add a <pom> formatter using SortPom to the root Spotless plugin configuration; each reactor module formats its own pom.xml through inheritance.
  • Normalize the root and 13 module POMs using the default recommended_2008_06 element order, UTF-8, two-space indentation, and self-closing empty elements (expandEmptyElements=false).
  • Keep the existing Java formatter unchanged. Do not enable dependency/plugin list, property, module, or execution sorting, and do not change dependency versions or plugin configuration values.
  • Document POM formatting and checking in CONTRIBUTING.md. The existing mvn spotless:check CI command now checks POMs as well; no separate workflow is needed.
  • Add a CHANGES.md entry linking to this PR.

The relevant formatting choices are compatible with the Google XML Style Guide, which permits two-space indentation and both empty-element forms and does not mandate a universal POM element order or fixed line width. IDE XML setting changes are out of scope; Spotless is the authoritative POM formatting baseline.

Test plan

Validated locally with JDK 17:

  • ./mvnw -B spotless:apply spotless:check — all 14 reactor projects passed; no Java source changes.
  • ./mvnw -B clean test — all reactor projects passed; 1,404 tests, 0 failures, 0 errors, 1 skipped.
  • Repeat spotless:apply spotless:check after the clean build — passed and changed none of the 1,599 tracked files (SHA-256 comparison).
  • XML tree comparison of all 14 POMs against upstream master — configuration values and repeated-element order preserved; only the intended formatter block was added, with whitespace/comment formatting and structural POM element ordering changes.
  • git diff --check — passed.

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Read the Contributing Guide before making this pull request.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit tests to verify the code. No new unit tests are needed for this formatting-only change; the existing suite and POM content/order comparison were run.
  • Run mvn clean test to make sure this pull request doesn't break anything.
  • Run mvn spotless:apply to format your code.
  • Update the CHANGES log — added in a follow-up commit using this PR URL.

🤖 Generated with Claude Code

Assisted-by: Claude Opus 5 (1M context)

Summary by CodeRabbit

  • Documentation
    • Updated contribution guidance to explain how Maven POM files are formatted and checked, including the formatting standards used.
  • Chores
    • Standardized Maven POM formatting across the project and added automated formatting checks for POM files. Existing project configuration and behavior remain unchanged.

Extend the existing formatter and CI check to Maven POM files so
contributors share one formatting baseline instead of IDE-specific output.
Normalize the reactor POMs and document the formatting policy without
changing dependencies or enabling dependency and plugin list sorting.

Fixes apolloconfig#5701

Assisted-by: Claude Opus 5 (1M context)
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e6570723-0b44-4351-8ab8-9922c501ee81
📥 Commits

Reviewing files that changed from the base of the PR and between ea35677 and 0ba1984.

📒 Files selected for processing: 16
  • CHANGES.md
  • CONTRIBUTING.md
  • apollo-adminservice/pom.xml
  • apollo-assembly/pom.xml
  • apollo-audit/apollo-audit-annotation/pom.xml
  • apollo-audit/apollo-audit-api/pom.xml
  • apollo-audit/apollo-audit-impl/pom.xml
  • apollo-audit/apollo-audit-spring-boot-starter/pom.xml
  • apollo-audit/pom.xml
  • apollo-biz/pom.xml
  • apollo-build-sql-converter/pom.xml
  • apollo-buildtools/pom.xml
  • apollo-common/pom.xml
  • apollo-configservice/pom.xml
  • apollo-portal/pom.xml
  • pom.xml

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

Spotless now formats Maven POM files. The root and module POMs were reformatted, and contributor guidance and the changelog were updated. Existing Maven configuration values remain unchanged.

Changes: Maven POM formatting

Layer / File(s) Summary
Configure POM formatting
pom.xml, CONTRIBUTING.md, CHANGES.md
Spotless now formats pom.xml files and keeps empty elements self-closing. The contributor guidance describes POM formatting and the spotless:check command. The changelog records the change.
Format project POMs
pom.xml, apollo-*/pom.xml, apollo-audit/*/pom.xml
The root and module POMs use consistent formatting and updated element ordering. Their existing configuration values are retained.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Possibly related issues

  • #5701: Requests Spotless SortPom formatting for Maven POM files, which this change configures and applies.

Suggested reviewers: nobodyiam

Merge Risk: ⚪ Minimal · up to 0ba19

The formatting check covers the module POMs, and no actionable issue remains; this change is mergeable after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "chore: standardize POM formatting with Spotless SortPom" matches the main change. The PR adds SortPom formatting for Maven POM files to the root Spotless configuration and reformats the roo…
Linked Issues check Passed Issue #5701 is addressed. The root pom.xml adds the Spotless POM formatter with SortPom and preserves the existing Java formatter. The PR formats the root and module POMs with the requested UTF-8, t…
Out of Scope Changes check Passed The changes stay within issue #5701. The diff contains the Spotless POM configuration, formatting changes to Maven POM files, contributor documentation, and a related CHANGES.md entry. It does not c…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Full details: Title check

Explanation

The title "chore: standardize POM formatting with Spotless SortPom" matches the main change. The PR adds SortPom formatting for Maven POM files to the root Spotless configuration and reformats the root and module POMs. The title is specific, short, and free of file lists or vague terms. The changeset also includes a CONTRIBUTING.md update and a CHANGES.md entry, which the title does not mention, but those are supporting documentation.

Full details: Linked Issues check

Explanation

Issue #5701 is addressed. The root pom.xml adds the Spotless POM formatter with SortPom and preserves the existing Java formatter. The PR formats the root and module POMs with the requested UTF-8, two-space, self-closing-element policy and preserves repeated-list order. CONTRIBUTING.md documents spotless:apply and spotless:check, including CI coverage. The reported reactor formatting check, idempotence check, clean test, and diff check passed.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #5701. The diff contains the Spotless POM configuration, formatting changes to Maven POM files, contributor documentation, and a related CHANGES.md entry. It does not change Java formatting, arbitrary XML resources, dependency versions, plugin values, or IDE XML settings.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (16 skipped: 16 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Record the SortPom formatting change with its upstream PR URL.

Assisted-by: Claude Opus 5 (1M context)

This branch has not been deployed

No deployments
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.

[Proposal] Standardize Maven POM formatting with Spotless SortPom

1 participant