You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[MNG-6135] Maven plugins and core extensions are not dependencies, they should be resolved the same way as projects. #7306
Due to a bug in the Maven resolver, plugin and core extensions were resolved incorrectly: the direct test and provided dependencies were ignored.
Ironically, this fix breaks some plugins because direct test dependencies now take precedence over transitive compile one: see MNG-5739
(we know only one case where provided case has an impact: MPLUGIN-296, and in this only case, the new behaviour is more consistent than the previous)
Issue Links:
MRESOLVER-8 ScopeDependencySelector incorrectly de-selects direct dependencies
("is blocked by")
MRESOLVER-9 DefaultDependencyCollector does not correctly handle dependency management
("is blocked by")
MRESOLVER-10 New 'TransitiveDependencyManager' supporting transitive dependency management
("is blocked by")
MNG-8559 Rewrite DefaultPluginManager with Maven 4 API
("Is contained by")
MNG-5739 Adding a test dependency can move dependencies from the compile scope to the test scope
MPLUGIN-321 improve documentation on maven-plugin-annotations telling that optional=true is sufficient
MEAR-246 Upgrade the EAR lifecycle to use the maven-resources-plugin 3.0.2.
("breaks")
Issue is fixed in the master branch of my private maven repository on github. When interested, you can cherry pick the commit to your own repository and create a pull request for the apache master branch with just this commit yourself from there.
@gnodet I reviewed the current plugin/core-extension resolution paths and the related issues. My understanding is that the core inconsistency still exists:
Project resolution uses a root artifact and adds direct dependencies explicitly.
Plugin and core-extension resolution use the plugin artifact as a root dependency.
The legacy scope selector therefore handles direct test and provided dependencies differently for projects versus plugins/extensions.
A direct selector change would address that inconsistency, but it may expose the mediation problem described in MNG-5739: a direct test dependency can win over a transitive compile dependency and then be removed from the runtime classpath.
MRESOLVER-8 and MRESOLVER-9 also appear relevant. MRESOLVER-10 is complete, and Maven 4 already supports transitive dependency management. PR #2000 seems complementary because it handles Maven core exports through plugin dependency management, but it does not address the root request and scope-selection difference by itself.
I can work on this with the following plan:
1. Establish the behavior with regression tests
Add focused integration tests covering:
A plugin with a direct test dependency.
A plugin with a direct provided dependency.
A core extension with the same cases.
A direct test dependency conflicting with a transitive compile dependency on the same artifact.
The equivalent provided versus transitive compile case.
The tests would assert both the collected graph and the actual plugin/extension class realm.
2. Verify the Resolver boundary
Confirm whether the current ScopeDependencySelector.fromDirect(...) behavior is sufficient for both request forms.
If dependency selection still occurs before managed scope or optionality is applied, the corresponding Resolver behavior should be fixed and tested separately rather than worked around inside Maven core.
3. Unify Maven 4 plugin and extension resolution
Prefer using the Maven 4 dependency resolver API and an explicit plugin resolution scope for both plugins and core extensions.
The implementation must preserve:
Plugin dependency overrides.
Optional dependencies and exclusions.
Repository and mirror handling.
Existing dependency graph transformers and filters.
Plugin and extension realm cache behavior.
Maven core artifact filtering covered by MNG-5783.
I would avoid changing the global repository-session selector because that could affect ordinary project dependency resolution.
4. Define compatibility explicitly
The historical implementation selected behavior according to the plugin's Maven prerequisites. I would not reuse its old version threshold without agreement because it no longer represents the current Maven 4 compatibility boundary.
Possible boundaries include:
Corrected behavior only with Maven 4 personality.
A plugin requiredMavenVersion boundary.
Another explicit compatibility switch.
5. Validate existing behavior
In addition to the new regression tests, run the existing plugin and extension ITs, particularly:
mng-5783-plugin-dependency-filtering
mng-5771-core-extensions
mng-4091
mng-4331
Then run the full Maven build and core integration-test suite.
Proposed delivery
I suggest splitting this into:
A regression-test PR defining the expected behavior.
A Resolver PR only if the tests prove a Resolver change is still required.
A Maven core PR unifying plugin and core-extension resolution.
Before I start, should MNG-6135 be handled as part of MNG-8559/#10668, and which compatibility boundary would you prefer? I can begin with the test-only PR once that direction is confirmed.
Activity
jira-importer commentedon Dec 21, 2016
Christian Schulte commented
Re-opening to edit links.
jira-importer commentedon Jan 9, 2017
Stephen Connolly commented
Maven 3.4.0 has been dropped. See this thread for more details.
This issue will need to be re-scheduled for a Maven release in the (hopefully near) future.
jira-importer commentedon Feb 1, 2017
Michael Osipov commented
Why is this fixed, where is the commit link?
jira-importer commentedon Feb 2, 2017
Christian Schulte commented
See this thread on dev@. Issue is resolved, not closed.
jira-importer commentedon Mar 25, 2017
Christian Schulte commented
Issue is fixed in the master branch of my private maven repository on github. When interested, you can cherry pick the commit to your own repository and create a pull request for the apache master branch with just this commit yourself from there.
jira-importer commentedon Oct 13, 2020
mike duigou commented
Why was this never cherry picked back in to maven master from the abandoned 3.4.0 branch?
jira-importer commentedon Oct 16, 2020
Michael Osipov commented
mike duigou, because this is a lot of work? Do you want to give it a try?
goutamadwant commentedon Aug 30, 2026
@gnodet I reviewed the current plugin/core-extension resolution paths and the related issues. My understanding is that the core inconsistency still exists:
testandprovideddependencies differently for projects versus plugins/extensions.A direct selector change would address that inconsistency, but it may expose the mediation problem described in MNG-5739: a direct
testdependency can win over a transitivecompiledependency and then be removed from the runtime classpath.MRESOLVER-8 and MRESOLVER-9 also appear relevant. MRESOLVER-10 is complete, and Maven 4 already supports transitive dependency management. PR #2000 seems complementary because it handles Maven core exports through plugin dependency management, but it does not address the root request and scope-selection difference by itself.
I can work on this with the following plan:
1. Establish the behavior with regression tests
Add focused integration tests covering:
testdependency.provideddependency.testdependency conflicting with a transitivecompiledependency on the same artifact.providedversus transitivecompilecase.<plugin><dependencies>overrides.The tests would assert both the collected graph and the actual plugin/extension class realm.
2. Verify the Resolver boundary
Confirm whether the current
ScopeDependencySelector.fromDirect(...)behavior is sufficient for both request forms.If dependency selection still occurs before managed scope or optionality is applied, the corresponding Resolver behavior should be fixed and tested separately rather than worked around inside Maven core.
3. Unify Maven 4 plugin and extension resolution
Prefer using the Maven 4 dependency resolver API and an explicit plugin resolution scope for both plugins and core extensions.
The implementation must preserve:
I would avoid changing the global repository-session selector because that could affect ordinary project dependency resolution.
4. Define compatibility explicitly
The historical implementation selected behavior according to the plugin's Maven prerequisites. I would not reuse its old version threshold without agreement because it no longer represents the current Maven 4 compatibility boundary.
Possible boundaries include:
requiredMavenVersionboundary.5. Validate existing behavior
In addition to the new regression tests, run the existing plugin and extension ITs, particularly:
mng-5783-plugin-dependency-filteringmng-5771-core-extensionsmng-4091mng-4331Then run the full Maven build and core integration-test suite.
Proposed delivery
I suggest splitting this into:
Before I start, should MNG-6135 be handled as part of MNG-8559/#10668, and which compatibility boundary would you prefer? I can begin with the test-only PR once that direction is confirmed.