#1105 Modified to properly report expression and defaultValue when processing Maven 4 plugin - #1106
Merged
slawekjaranowski merged 3 commits intoAug 3, 2026
Conversation
…ng a Maven 4 plugin descriptor.
slawekjaranowski
force-pushed
the
report-defaultValue-from-maven4-descriptor
branch
from
August 2, 2026 14:38
27ee81a to
ae34c71
Compare
There was a problem hiding this comment.
Pull request overview
This pull request updates maven-plugin-report-plugin so it can correctly extract expression and defaultValue for parameters when consuming Maven 4’s plugin-enhanced.xml, and adds/extends integration tests to verify the generated report HTML reflects those values.
Changes:
- Detect Maven 4 descriptors and read parameter
expression/defaultValuefrom Maven 4-specific elements. - Extend the existing
plugin-reportIT to assert the report mojo page includes the expected default value. - Add a new Maven 4-focused IT (
plugin-report-400) plus wiring to passmaven4Versioninto Groovy verification scripts.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| maven-plugin-report-plugin/src/main/java/org/apache/maven/plugins/plugin/descriptor/PluginDescriptorBuilder.java | Adds Maven 4 detection and switches parameter expression/defaultValue extraction logic for Maven 4 descriptors. |
| maven-plugin-report-plugin/src/it/plugin-report/verify.groovy | Adds an assertion that report-mojo.html contains the expected default value rendering. |
| maven-plugin-report-plugin/src/it/plugin-report-400/verify.groovy | New Maven 4 integration verification script covering requirements + default value rendering. |
| maven-plugin-report-plugin/src/it/plugin-report-400/src/main/java/org/MyMojo.java | New IT plugin mojo used to generate documentation under Maven 4. |
| maven-plugin-report-plugin/src/it/plugin-report-400/src/main/java/org/DummyReport.java | New IT report goal used to produce a report-mojo page whose default value must be reported correctly. |
| maven-plugin-report-plugin/src/it/plugin-report-400/pom.xml | New IT project POM targeting Maven 4 APIs and generating a site. |
| maven-plugin-report-plugin/src/it/plugin-report-400/invoker.properties | Configures the new IT to run clean site. |
| maven-plugin-report-plugin/pom.xml | Exposes maven4Version to invoker Groovy scripts via scriptVariables. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (1)
maven-plugin-report-plugin/src/main/java/org/apache/maven/plugins/plugin/descriptor/PluginDescriptorBuilder.java:299
- The expression/defaultValue parsing is currently gated solely on
isV4. SinceisV4is derived from<requiredMavenVersion>(which can be configured independently of the descriptor schema), this can silently drop values when the descriptor uses the legacy<configuration>style butrequiredMavenVersionstarts with "4" (or vice versa). A more robust approach is to prefer the Maven 4<expression>/<defaultValue>elements when they are present, and otherwise fall back to the legacy<configuration>lookup.
if (isV4) {
parameter.setExpression(d.getChild("expression").getValue());
parameter.setDefaultValue(d.getChild("defaultValue").getValue());
} else {
PlexusConfiguration paramConfig = mojoConfig.getChild(parameter.getName(), false);
slawekjaranowski
approved these changes
Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This includes a change to
PluginDescriptorBuilderto properly retrieve the theexpressionanddefaultValuevalues from the Maven 4plugin-enhanced.xmlfile when building a plugin for Maven 4. It also includes a new integration test,plugin-report-400, to confirm.