Skip to content

#1105 Modified to properly report expression and defaultValue when processing Maven 4 plugin - #1106

Merged
slawekjaranowski merged 3 commits into
apache:masterfrom
bradleylarrick:report-defaultValue-from-maven4-descriptor
Aug 3, 2026
Merged

#1105 Modified to properly report expression and defaultValue when processing Maven 4 plugin#1106
slawekjaranowski merged 3 commits into
apache:masterfrom
bradleylarrick:report-defaultValue-from-maven4-descriptor

Conversation

@bradleylarrick

Copy link
Copy Markdown
Contributor

This includes a change to PluginDescriptorBuilder to properly retrieve the the expression and defaultValue values from the Maven 4 plugin-enhanced.xml file when building a plugin for Maven 4. It also includes a new integration test, plugin-report-400, to confirm.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 / defaultValue from Maven 4-specific elements.
  • Extend the existing plugin-report IT to assert the report mojo page includes the expected default value.
  • Add a new Maven 4-focused IT (plugin-report-400) plus wiring to pass maven4Version into 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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. Since isV4 is 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 but requiredMavenVersion starts 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
slawekjaranowski merged commit 4c9d851 into apache:master Aug 3, 2026
17 checks passed
@github-actions github-actions Bot added this to the 4.0.0-beta-3 milestone Aug 3, 2026
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.

report-plugin not reporting expression or defaultValue for parameters of Maven 4 plugins

3 participants