maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From schu...@apache.org
Subject maven git commit: [MNG-6135] Maven plugins and core extensions are not dependencies, they should be resolved the same way as projects.
Date Sat, 17 Dec 2016 06:23:47 GMT
Repository: maven
Updated Branches:
  refs/heads/master 9fef375bb -> 14bff2c5c


[MNG-6135] Maven plugins and core extensions are not dependencies, they should be resolved
the same way as projects.

o Corrected the 'PluginDependencySelector.deriveChildSelector' method to return
  a new instance for the child context instead of changing the instance in use
  with a different context.
o Corrected the 'PluginDependencyManager.deriveChildManager' method to return a
  new instance for the child context instead of changing the instane in use
  with a different context.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/14bff2c5
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/14bff2c5
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/14bff2c5

Branch: refs/heads/master
Commit: 14bff2c5c5a0729e39f7d0fc62ed733222c90a18
Parents: 9fef375
Author: Christian Schulte <schulte@apache.org>
Authored: Sat Dec 17 07:13:58 2016 +0100
Committer: Christian Schulte <schulte@apache.org>
Committed: Sat Dec 17 07:16:43 2016 +0100

----------------------------------------------------------------------
 .../DefaultPluginDependenciesResolver.java      | 43 +++++++++++++-------
 1 file changed, 29 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/14bff2c5/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 f02be6a..95e1cb8 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
@@ -165,12 +165,17 @@ public class DefaultPluginDependenciesResolver
         class PluginDependencySelector implements DependencySelector
         {
 
-            private int depth;
+            private final int depth;
 
             PluginDependencySelector()
             {
+                this( 0 );
+            }
+
+            private PluginDependencySelector( final int depth )
+            {
                 super();
-                this.depth = 0;
+                this.depth = depth;
             }
 
             @Override
@@ -186,8 +191,10 @@ public class DefaultPluginDependenciesResolver
             public DependencySelector deriveChildSelector( final DependencyCollectionContext
context )
             {
                 assert context.getDependency() != null : "Unexpected POM resolution.";
-                this.depth++;
-                return this;
+                return this.depth >= 2
+                           ? this
+                           : new PluginDependencySelector( this.depth + 1 );
+
             }
 
         }
@@ -197,16 +204,24 @@ public class DefaultPluginDependenciesResolver
         class PluginDependencyManager implements DependencyManager
         {
 
-            private int depth;
+            private final int depth;
 
-            private DependencyManager defaultManager = session.getDependencyManager();
+            private final DependencyManager defaultManager;
 
-            private List<Artifact> exlusions = new LinkedList<>();
+            private final List<Artifact> exclusions;
 
             PluginDependencyManager()
             {
+                this( 0, session.getDependencyManager(), new LinkedList<Artifact>()
);
+            }
+
+            private PluginDependencyManager( final int depth, final DependencyManager defaultManager,
+                                             final List<Artifact> exclusions )
+            {
                 super();
-                this.depth = 0;
+                this.depth = depth;
+                this.defaultManager = defaultManager;
+                this.exclusions = exclusions;
             }
 
             @Override
@@ -240,17 +255,17 @@ public class DefaultPluginDependenciesResolver
             public DependencyManager deriveChildManager( final DependencyCollectionContext
context )
             {
                 assert context.getDependency() != null : "Unexpected POM resolution.";
-                this.depth++;
-                this.defaultManager = this.defaultManager != null
-                                          ? this.defaultManager.deriveChildManager( context
)
-                                          : null;
+                return new PluginDependencyManager( this.depth + 1,
+                                                    this.defaultManager != null
+                                                        ? this.defaultManager.deriveChildManager(
context )
+                                                        : null,
+                                                    this.exclusions );
 
-                return this;
             }
 
             public List<Artifact> getExclusions()
             {
-                return this.exlusions;
+                return this.exclusions;
             }
 
         }


Mime
View raw message