Skip to content

Replace JDOM2 with DomTrip for lossless POM XML editing#1466

Open
gnodet wants to merge 1 commit intomasterfrom
available-felidae
Open

Replace JDOM2 with DomTrip for lossless POM XML editing#1466
gnodet wants to merge 1 commit intomasterfrom
available-felidae

Conversation

@gnodet
Copy link
Copy Markdown

@gnodet gnodet commented Apr 3, 2026

Summary

Closes #1381

  • Replace org.jdom:jdom2 dependency with eu.maveniverse.maven.domtrip:domtrip-core:1.1.0
  • Implement 16 DomTrip wrapper classes mirroring the previous JDOM2 wrappers (DomTripModel, DomTripModelETL, DomTripScm, DomTripProperties, etc.)
  • Delete all JDOM2 source (18 files) and test (8 files) classes
  • Switch default ModelETL from jdom2 to domtrip
  • Add 8 new unit test classes (147 tests) covering all DomTrip wrapper classes
  • Add formatting preservation IT with byte-for-byte exact comparison
  • Fix DomTripProperties.put() to return the previous value per the Hashtable.put contract

DomTrip provides lossless XML round-tripping, preserving comments, whitespace, attribute order, quote styles, CDATA sections, and entity encoding. This eliminates the intro/outtro hacks that the JDOM2 implementation required (regex-based intro/outtro extraction, whitespace collapsing in attributes, line ending normalization).

Breaking change

The ModelETLFactory named binding changed from "jdom2-sax" to "domtrip". This is an internal extension point not exposed via public configuration — no external consumers are known to reference the old name. If you subclassed AbstractRewritePomsPhase and hardcoded "jdom2-sax", update to "domtrip".

Test plan

  • All existing tests pass (769 tests, 0 failures, 0 errors)
  • 147 new unit tests for DomTrip wrapper classes
  • Formatting preservation IT verifies byte-for-byte output (multi-line attributes, mixed tab/space indentation, inline comments, extra blank lines)
  • Full reactor build succeeds across all 6 modules
  • UTF-16 encoded POM files handled correctly
  • CDATA sections preserved during version rewrites

🤖 Generated with Claude Code

@cstamas
Copy link
Copy Markdown
Member

cstamas commented Apr 3, 2026

woohoo! 2k lines gone!

@cstamas cstamas requested a review from kwin April 3, 2026 19:12
DomTrip provides lossless XML round-tripping, preserving comments,
whitespace, attribute order, quote styles, CDATA sections, and entity
encoding. This eliminates the intro/outtro hacks required by JDOM2.

- Replace `org.jdom:jdom2` with `eu.maveniverse.maven.domtrip:domtrip-core:1.1.0`
- Implement 16 DomTrip wrapper classes mirroring the previous JDOM2 wrappers
- Delete all JDOM2 source (18 files) and test (8 files) classes
- Switch default ModelETL from `jdom2` to `domtrip`
- Add 8 new unit test classes (147 tests) covering all DomTrip wrappers
- Add formatting preservation IT with byte-for-byte comparison
- Fix `DomTripProperties.put()` to return previous value per `Hashtable.put` contract

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet force-pushed the available-felidae branch from 0bc4b06 to 566e048 Compare April 9, 2026 07:53
@gnodet gnodet marked this pull request as ready for review April 9, 2026 07:54
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.

Replace JDom with Domtrip

2 participants