GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix #327: evaluate model collections on Maven 4 by wilx · Pull Request #417 · apache/maven-help-plugin

Conversation

@wilx

@wilx wilx commented Aug 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

Fixes #327 for the Maven 4-enabled line.

Maven 4 exposes evaluated model collections through WrapperList and uses immutable collection and map implementations inside the model. XStream does not recognize these implementations and falls back to reflective serialization, which fails when it tries to access JDK internals such as AbstractList.modCount.

This change registers collection and map converters that accept their public interfaces and aliases the concrete runtime list class so the existing XML root name is preserved. The evaluated list is serialized directly without copying it.

The commits are intentionally split: the first adds the regression IT and fails with the WrapperList reflection error; the second applies the fix.

Validation

  • Maven 3.10.0-rc-1 / JDK 17 -Prun-its clean verify: all 26 unit tests and all 35 applicable ITs passed; the Maven 4-only regression IT was skipped
  • Maven 4.0.0-rc-6 / JDK 21 clean verify: all 26 unit tests passed
  • Maven 4.0.0-rc-6 / JDK 21 focused -Prun-its clean verify: passed
  • Maven 4.0.0-rc-6 / JDK 25 focused -Prun-its clean verify: passed
  • Maven 4.0.0-rc-6 / JDK 21 full clean verify: the new IT passed; two existing Describe ITs failed (describe-cmd-with-goal-report and describe-plugin-without-name)

Checklist

  • This pull request addresses one issue without unrelated changes.

  • The description explains what changed, how, and why.

  • Each commit has a meaningful subject line and body. Commit subjects are meaningful; no commit bodies were added.

  • A regression integration test fails without the runtime change.

  • mvn verify was run successfully.

  • The complete Maven 3 integration-test suite and the focused Maven 4 regression IT were run successfully; unrelated full-suite RC6 failures are documented above.

  • I hereby declare this contribution to be licensed under the Apache License Version 2.0, January 2004

  • In any other case, an Apache Individual Contributor License Agreement has been filed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@wilx
wilx marked this pull request as ready for review August 9, 2026 13:35
@slachiewicz slachiewicz added the bug Something isn't working label Aug 10, 2026
@wilx wilx mentioned this pull request Aug 22, 2026
[MPH-210] Fix help:evaluate for Maven 3 model collections #425
Merged
8 of 9 tasks
@wilx
wilx force-pushed the issue-327-maven-4 branch from 070c9e3 to 93f3845 Compare September 4, 2026 21:17
elharo
elharo requested changes Sep 17, 2026
View reviewed changes

@elharo elharo left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

needs tests

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@wilx
wilx force-pushed the issue-327-maven-4 branch 2 times, most recently from 49e9dbd to 5c1b173 Compare September 17, 2026 18:02
@wilx

wilx commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

needs tests

I have added a test case.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

wilx added 2 commits October 27, 2026 21:56
@wilx @slachiewicz
Add regression test for issue apache#327
cbb9fc2
@wilx @slachiewicz
Fixes apache#327: Evaluate model collections without reflection
70bf0bd
@slachiewicz
slachiewicz force-pushed the issue-327-maven-4 branch from 5c1b173 to 70bf0bd Compare October 27, 2026 20:56
slachiewicz
slachiewicz reviewed Oct 27, 2026
View reviewed changes

@slachiewicz slachiewicz left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

On Maven 4.0.0-rc-7 this no longer crashes, but help:evaluate -Dexpression=project.build.resources now prints the internal delegate wrapper with InputLocation trees, and verify.groovy asserts that shape. Could you unwrap the delegate (or omit locations) and have the IT check only the user-facing elements?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions

This comment has been minimized.

Sign in to view
wilx added 2 commits October 28, 2026 08:39
@wilx
Flatten Maven 4 model delegates in evaluate output
3fef392
@wilx
Restore short XML aliases in evaluate output
5b4ae22
Replace JAR entry path separators with dots without inserting regex escapes. Skip package-info metadata during alias discovery to avoid class-loading errors on Maven 4.

Verify short names for model collections, nested delegates, maps, and settings servers.
@wilx

wilx commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

On Maven 4.0.0-rc-7 this no longer crashes, but help:evaluate -Dexpression=project.build.resources now prints the internal delegate wrapper with InputLocation trees, and verify.groovy asserts that shape. Could you unwrap the delegate (or omit locations) and have the IT check only the user-facing elements?

Fixed. Also, I made a change that restores uses of short names instead of FQCNs in the output.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@slachiewicz
Hide Maven 4 collection classes and caches in evaluate output
959749e
Flattening the delegate still exposed the API model's immutable collection
implementations as class="org.apache.maven.api.model.ImmutableCollections$List2"
attributes on every collection field, XStream back references to the shared
empty-collection singleton (reference="../includes"), string maps written as
<entry> pairs instead of the Maven 3 <key>value</key> form, and the lazily
populated caches pluginMap, reportSetMap and managementKey whenever an earlier
call had filled them. The mapper now names the immutable collections like the
default implementations, treats them as value types, and skips the caches; a
converter writes the API model's string maps like Properties. Maven 3 output
is unchanged.
@slawekjaranowski

slawekjaranowski commented Nov 8, 2026

Copy link
Copy Markdown
Member

@elharo tests was added

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

slawekjaranowski
slawekjaranowski approved these changes Nov 9, 2026
View reviewed changes
elharo
elharo reviewed Nov 9, 2026
View reviewed changes
Comment thread src/main/java/org/apache/maven/plugins/help/MavenModelConverter.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@slawekjaranowski
slawekjaranowski requested a review from elharo November 9, 2026 22:43
@slawekjaranowski slawekjaranowski mentioned this pull request Nov 14, 2026
Remove XStream from project #460
Open
@slawekjaranowski
slawekjaranowski merged commit b7e04b5 into apache:master Nov 14, 2026
19 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot assigned slawekjaranowski Nov 14, 2026
@github-actions github-actions Bot added this to the 3.5.3 milestone Nov 14, 2026
This was referenced Nov 14, 2026
[MPH-209] Improve rendering of project elements in Maven 4 #328
Closed
Planned releases — Q4 2026 (Doxia stack + plugins + shared deps) apache/maven#13085
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@slawekjaranowski slawekjaranowski slawekjaranowski approved these changes
@slachiewicz slachiewicz slachiewicz left review comments
@elharo elharo Awaiting requested review from elharo

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@slawekjaranowski slawekjaranowski

Labels

bug Something isn't working

Projects

None yet

Milestone

3.6.0

Development

Successfully merging this pull request may close these issues.

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

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@wilx @slawekjaranowski @elharo @slachiewicz
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.