You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sc...@apache.org on 2016/12/31 20:36:07 UTC
maven git commit: [MNG-6135] Maven plugins and core extensions are
not dependencies,
they should be resolved the same way as projects. [MNG-4276] Plugins with
indirect dependency on plexus-utils are stuck with plexus-utils:1.1
[MNG-4274] Plugins with an
Repository: maven
Updated Branches:
refs/heads/master ae9c2269e -> 859651acf
[MNG-6135] Maven plugins and core extensions are not dependencies, they should be resolved the same way as projects.
[MNG-4276] Plugins with indirect dependency on plexus-utils are stuck with plexus-utils:1.1
[MNG-4274] Plugins with an undeclared but transitive dependency on plexus-utils via a core artifact get wrong version of p-u
o During working on MNG-6135, it turned out that plugin dependency management
also is applied to the dependencies declared for a plugin using the
'plugins/plugin/dependencies/dependency' element. Dependencies declared
that way must not be overridden by any management. I added management for
'plexus-utils' in the core IT suite. This immediately made the ITs
for MNG-4276 and MNG-4274 fail, because 'plexus-utils' got subject
to management although a different version has been declared in
the plugin declaration.
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/859651ac
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/859651ac
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/859651ac
Branch: refs/heads/master
Commit: 859651acfc73af2a2afcd044306eaa0e5e5ac51a
Parents: ae9c226
Author: Christian Schulte <sc...@apache.org>
Authored: Sat Dec 31 21:27:00 2016 +0100
Committer: Christian Schulte <sc...@apache.org>
Committed: Sat Dec 31 21:28:47 2016 +0100
----------------------------------------------------------------------
.../DefaultPluginDependenciesResolver.java | 42 ++++++++++----------
1 file changed, 20 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/859651ac/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
index 874ed05..446fd01 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
@@ -150,21 +150,21 @@ public class DefaultPluginDependenciesResolver
private final int depth;
- private final DependencyManager defaultManager;
+ private final DependencyManager delegate;
private final List<Artifact> exclusions;
- PluginDependencyManager()
+ PluginDependencyManager( final DependencyManager delegate )
{
- this( 0, session.getDependencyManager(), new LinkedList<Artifact>() );
+ this( 0, delegate, new LinkedList<Artifact>() );
}
- private PluginDependencyManager( final int depth, final DependencyManager defaultManager,
+ private PluginDependencyManager( final int depth, final DependencyManager delegate,
final List<Artifact> exclusions )
{
super();
this.depth = depth;
- this.defaultManager = defaultManager;
+ this.delegate = delegate;
this.exclusions = exclusions;
}
@@ -189,8 +189,8 @@ public class DefaultPluginDependenciesResolver
}
}
- return !excluded && this.depth >= 2 && this.defaultManager != null
- ? this.defaultManager.manageDependency( dependency )
+ return !excluded && this.depth >= 2 && this.delegate != null
+ ? this.delegate.manageDependency( dependency )
: null;
}
@@ -199,8 +199,8 @@ public class DefaultPluginDependenciesResolver
public DependencyManager deriveChildManager( final DependencyCollectionContext context )
{
return new PluginDependencyManager( this.depth + 1,
- this.defaultManager != null
- ? this.defaultManager.deriveChildManager( context )
+ this.delegate != null
+ ? this.delegate.deriveChildManager( context )
: null,
this.exclusions );
@@ -325,13 +325,15 @@ public class DefaultPluginDependenciesResolver
final DependencyGraphTransformer pluginDependencyGraphTransformer =
ChainedDependencyGraphTransformer.newInstance( session.getDependencyGraphTransformer(), transformer );
- final PluginDependencyManager pluginDependencyManager = new PluginDependencyManager();
+ final PluginDependencyManager pluginDependencyManager =
+ new PluginDependencyManager( classicResolution
+ ? new ClassicDependencyManager()
+ : session.getDependencyManager() );
+
DefaultRepositorySystemSession pluginSession = new DefaultRepositorySystemSession( session );
pluginSession.setDependencySelector( pluginDependencySelector );
pluginSession.setDependencyGraphTransformer( pluginDependencyGraphTransformer );
- pluginSession.setDependencyManager( classicResolution
- ? new ClassicDependencyManager()
- : pluginDependencyManager );
+ pluginSession.setDependencyManager( pluginDependencyManager );
CollectRequest request = new CollectRequest();
request.setRequestContext( REPOSITORY_CONTEXT );
@@ -340,24 +342,20 @@ public class DefaultPluginDependenciesResolver
for ( Dependency dependency : plugin.getDependencies() )
{
org.eclipse.aether.graph.Dependency pluginDep =
- RepositoryUtils.toDependency( dependency, session.getArtifactTypeRegistry() );
+ RepositoryUtils.toDependency( dependency, session.getArtifactTypeRegistry() );
if ( !JavaScopes.SYSTEM.equals( pluginDep.getScope() ) )
{
pluginDep = pluginDep.setScope( JavaScopes.RUNTIME );
}
request.addDependency( pluginDep );
- if ( !classicResolution )
+ if ( logger.isDebugEnabled() )
{
- if ( logger.isDebugEnabled() )
- {
- logger.debug( String.format( "Collecting plugin dependency %s from project.", pluginDep ) );
- }
+ logger.debug( String.format( "Collecting plugin dependency %s from project.", pluginDep ) );
+ }
- pluginDependencyManager.getExclusions().
+ pluginDependencyManager.getExclusions().
addAll( this.collectPluginDependencyArtifacts( session, repositories, pluginDep ) );
-
- }
}
request.setRoot( new org.eclipse.aether.graph.Dependency( pluginArtifact, null ) );