Fix/916 require same versions for managed report plugins - #1024
Conversation
Then I've re-found https://maven.apache.org/guides/mini/guide-configuring-plugins.html#Configuring_Reporting_Plugins
That has re-surprised me a lot, to encourage such duplication... So for:
I'd like to confirm - report plugin version IS NOT provided by |
a6293d3 to
96f46bc
Compare
Yes, the report plugin version is provided through This matches the configuration from the original #916 reproducer. Maven allows the reporting plugin version to be resolved from The issue is that So the integration test intentionally leaves the reporting version unspecified to reproduce that exact case. The fix uses the managed version when no explicit reporting version is present. |
|
I'm confused for following reasons:
Can you link to some documentation that support:
? |
|
(I'm not challenging this PR in any way, just using this, perhaps not quite proper channel, to learn more about that case.) |
Thanks for pointing this out. I’m still learning the Maven reporting/plugin resolution behavior, so I may be misunderstanding part of it. I found the official Maven Model documentation for https://maven.apache.org/ref/3.9.15/apidocs/org/apache/maven/model/ReportPlugin.html The Maven Model reference documents the same behavior for the https://maven.apache.org/ref/3.9.15/maven-model/maven.html So my current understanding is that the version can be resolved from In the #916 reproducer, the report plugin is intentionally left without a version under I’ll review this behavior further to make sure I’m understanding Maven’s resolution correctly. |
Perfect! Thanks! |
Thanks again for the question — I looked further into Maven's report plugin resolution to make sure the implementation matches Maven's behavior. I found that the effective reporting plugin version is resolved in this order: an explicitly configured My initial implementation only covered the explicit reporting version and I also verified the original #916 reproducer with the Maven Invoker integration test, which now passes successfully. |
Description
Fixes #916.
RequireSameVersionscan incorrectly report different versions for a report plugin when the plugin version is managed through<pluginManagement>.When a report plugin is declared without an explicit version, Maven can expose its artifact with version
RELEASE, even though the plugin has a version defined in the project's<pluginManagement>.For example, this can result in
RequireSameVersionscomparing:and incorrectly reporting a version mismatch.
Changes
The report-plugin version lookup now:
<pluginManagement>.The existing handling of
<plugins>,<buildPlugins>, and<reportPlugins>is preserved.Tests
Added a unit regression test covering a report plugin whose artifact version is
RELEASEwhile its managed version is3.5.3.Added an integration test reproducing the issue with a report plugin whose version is provided through
<pluginManagement>.The existing
RequireSameVersionstests and integration tests were also run to ensure the changes do not regress the behavior introduced by #892, where entries in<plugins>are considered when checking build and report plugins.Fixes #916