Skip to content

[MPH-210] Fix help:evaluate for Maven 3 model collections - #425

Merged
elharo merged 2 commits into
apache:masterfrom
wilx:issue-327-maven-3
Aug 25, 2026
Merged

[MPH-210] Fix help:evaluate for Maven 3 model collections#425
elharo merged 2 commits into
apache:masterfrom
wilx:issue-327-maven-3

Conversation

@wilx

@wilx wilx commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #327.

help:evaluate can receive model collections implemented by Maven 3's internal
ModelMerger.MergingList. XStream does not recognize that implementation as a
collection and falls back to reflective serialization. On recent JDKs, this
fails when it tries to access AbstractList.modCount.

This change registers a collection converter that accepts every Collection
implementation and aliases the concrete runtime list class so the existing XML
root name is preserved. The evaluated list is serialized directly without
copying it.

This PR targets master, the current 3.5.x line. The plugin still declares
Maven 3.6.3 as its runtime prerequisite. The regression IT is limited to Maven
3 because Maven 4 exposes different model collection implementations.

This replaces #416, which targeted the 3.4.x maintenance branch currently under
retirement review. PR #417 covers Maven 4-specific collection and map
implementations and can build on this Maven 3 change. The commits remain
intentionally split: the first adds the regression IT and the second applies
the fix.

Validation

  • Maven 3.9.16 / JDK 21: mvn -Prun-its clean verify - 30 unit tests and all
    36 integration tests passed.
  • Maven 3.10.0-rc-1 / JDK 21: mvn -Prun-its clean verify - 30 unit tests and
    all 36 integration tests passed.
  • Maven 4.0.0-rc-6 / JDK 21: the unit-test phase passed all 30 tests. The full
    Invoker run passed 32 tests, skipped 2 Maven-version-specific tests, and hit
    the two existing unrelated failures also documented by Fix #327: evaluate model collections on Maven 4 #417:
    describe-cmd-with-goal-report and describe-plugin-without-name.
  • mvn spotless:apply made no changes.
  • The failure was reproduced before the fix with Help Plugin 3.5.2, Maven
    3.9.16, and JDK 21.

Checklist

  • A JIRA issue exists for this change: MPH-210.
  • This pull request addresses only that issue.
  • Each commit has a meaningful subject line and body.
  • The pull request title follows the [MPH-XXX] convention.
  • This description explains what changed, how, and why.
  • mvn clean verify passed.
  • The integration tests passed with Maven 3.9.16 and Maven 3.10.0-rc-1.
  • I hereby declare this contribution to be licenced under the
    Apache License Version 2.0, January 2004.
  • In any other case, an Apache Individual Contributor License Agreement has
    been filed.

wilx added 2 commits August 21, 2026 23:09
Exercise help:evaluate with project.build.resources under Maven 3 so
ModelMerger.MergingList serialization is covered.
Register a collection converter for model list implementations so XStream
serializes them as collections instead of reflecting into JDK internals.

Fixes apache#327
@wilx
wilx marked this pull request as ready for review August 22, 2026 15:10
@elharo
elharo merged commit 5ac0be0 into apache:master Aug 25, 2026
17 checks passed
@github-actions github-actions Bot added this to the 3.5.3 milestone Aug 25, 2026
@github-actions

Copy link
Copy Markdown

@elharo Please assign appropriate label to PR according to the type of change.

@elharo elharo added the bug Something isn't working label Aug 25, 2026
@wilx
wilx deleted the issue-327-maven-3 branch August 25, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MPH-210] Failure to evaluate on Maven 3.9 + JDK 21

2 participants