You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2018/12/30 12:04:55 UTC

[maven] branch MNG-5600 updated (a90979b -> 66f4537)

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a change to branch MNG-5600
in repository https://gitbox.apache.org/repos/asf/maven.git.


 discard a90979b  [MNG-5600] Dependency management import should support exclusions.
     new 66f4537  [MNG-5600] Dependency management import should support exclusions

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (a90979b)
            \
             N -- N -- N   refs/heads/MNG-5600 (66f4537)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/maven/model/building/DefaultModelBuilder.java   | 10 ----------
 1 file changed, 10 deletions(-)


[maven] 01/01: [MNG-5600] Dependency management import should support exclusions

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MNG-5600
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 66f4537f08da8ec0815c320520715560e17a3077
Author: Christian Schulte <sc...@apache.org>
AuthorDate: Sun Jun 19 16:32:25 2016 +0200

    [MNG-5600] Dependency management import should support exclusions
---
 .../maven/model/building/DefaultModelBuilder.java  | 36 +++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
index 8714611..e10938f 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
@@ -27,6 +27,7 @@ import org.apache.maven.model.Activation;
 import org.apache.maven.model.Build;
 import org.apache.maven.model.Dependency;
 import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.Exclusion;
 import org.apache.maven.model.InputLocation;
 import org.apache.maven.model.InputSource;
 import org.apache.maven.model.Model;
@@ -1308,7 +1309,40 @@ public class DefaultModelBuilder
                     importMgmt = new DependencyManagement();
                 }
 
-                putCache( request.getModelCache(), groupId, artifactId, version, ModelCacheTag.IMPORT, importMgmt );
+                // [MNG-5600] Dependency management import should support exclusions.
+                if ( !dependency.getExclusions().isEmpty() )
+                {
+                    for ( final Exclusion exclusion : dependency.getExclusions() )
+                    {
+                        if ( exclusion.getGroupId() != null && exclusion.getArtifactId() != null )
+                        {
+                            for ( final Iterator<Dependency> dependencies = importMgmt.getDependencies().iterator();
+                                  dependencies.hasNext(); )
+                            {
+                                final Dependency candidate = dependencies.next();
+
+                                if ( ( exclusion.getGroupId().equals( "*" )
+                                       || exclusion.getGroupId().equals( candidate.getGroupId() ) )
+                                         && ( exclusion.getArtifactId().equals( "*" )
+                                              || exclusion.getArtifactId().equals( candidate.getArtifactId() ) ) )
+                                {
+                                    // Dependency excluded from import.
+                                    dependencies.remove();
+                                }
+                            }
+                        }
+                    }
+
+                    for ( final Dependency includedDependency : importMgmt.getDependencies() )
+                    {
+                        includedDependency.getExclusions().addAll( dependency.getExclusions() );
+                    }
+                }
+                else
+                {
+                    // Only dependency managements without exclusion processing applied can be cached.
+                    putCache( request.getModelCache(), groupId, artifactId, version, ModelCacheTag.IMPORT, importMgmt );
+                }
             }
 
             if ( importMgmts == null )