Skip to content

Conversation

@slachiewicz
Copy link
Member

Summary

This PR upgrades the project to use Maven 4.0.0-rc-5 and migrates from internal Maven APIs to public APIs where possible, while maintaining backwards compatibility.

Changes

Main Code Changes

  1. Xpp3DomBuilder.java

    • Replace org.apache.maven.internal.xml.XmlNodeBuilder with public API org.apache.maven.api.xml.XmlService for cases with trim=true (default behavior)
    • Keep XmlNodeBuilder (internal API) only for trim=false cases to preserve backwards compatibility (XmlService doesn't support trim parameter)
    • Update InputLocationBuilder interface to accept javax.xml.stream.XMLStreamReader instead of XmlPullParser (aligns with Maven 4 public API)
  2. XmlPullParserToXMLStreamReaderAdapter.java (new)

    • Create adapter to convert XmlPullParserXMLStreamReader
    • Enables using existing parsers with new Maven 4 API
    • Implements all required methods including hasName() and hasText()
  3. XmlPullParserException.java

    • Remove deprecated detail field (marked @Deprecated)
    • Remove deprecated getDetail() method - use standard getCause() instead

Test Changes

  1. Xpp3DomTest.java

    • Update FixedInputLocationBuilder to accept XMLStreamReader instead of XmlPullParser
  2. Xpp3DomBuilderTest.java

    • Update anonymous InputLocationBuilder implementation to use XMLStreamReader.getLocation().getLineNumber() instead of XmlPullParser.getLineNumber()

Testing

✅ All 217 tests pass (1 skipped)
✅ Code compiles without errors
✅ Package builds successfully
✅ Uses Maven 4 public API where possible (XmlService for trim=true)
⚠️ Minimal use of internal API only for special cases (trim=false) - required for backwards compatibility

API Usage

  • Public: org.apache.maven.api.xml.XmlService, org.apache.maven.api.xml.XmlNode
  • Internal (minimal): org.apache.maven.internal.xml.XmlNodeBuilder - only for trim=false
  • Internal (existing): org.apache.maven.internal.xml.XmlNodeImpl - used throughout project as wrapper

- Replace XmlNodeBuilder (internal API) with XmlService (public API) for trim=true cases
- Keep XmlNodeBuilder only for trim=false to preserve backwards compatibility
- Add XmlPullParserToXMLStreamReaderAdapter to bridge XmlPullParser and XMLStreamReader
- Update InputLocationBuilder interface to use XMLStreamReader instead of XmlPullParser
- Remove deprecated 'detail' field and getDetail() method from XmlPullParserException
- Update tests to match new InputLocationBuilder signature

All 217 tests pass successfully.
@slachiewicz
Copy link
Member Author

@gnodet wdyt - make sense this PR?
Do we want to continue with plexus-xml for mvn 4?

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.

1 participant