[MNG-5639] Support resolution of Import Scope POMs from Repo that contains a 
${parameter}

o Updated to stop replacing external repositories when repository merging is set
  to REQUEST_DOMINANT.


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

Branch: refs/heads/DEPMGMT-INCLUDE-IT
Commit: def2738a549aa6c2ee3f72bdb92e872592749317
Parents: 2069b82
Author: Christian Schulte <schu...@apache.org>
Authored: Tue Dec 13 20:16:20 2016 +0100
Committer: Christian Schulte <schu...@apache.org>
Committed: Wed Feb 1 21:22:33 2017 +0100

----------------------------------------------------------------------
 .../project/DefaultProjectBuildingRequest.java   | 19 +++++++++++--------
 .../maven/project/ProjectModelResolver.java      | 12 +++++++++++-
 2 files changed, 22 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/def2738a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java
----------------------------------------------------------------------
diff --git 
a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java
 
b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java
index dafbefd..d42da04 100644
--- 
a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java
+++ 
b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java
@@ -80,22 +80,25 @@ public class DefaultProjectBuildingRequest
         pluginArtifactRepositories = new ArrayList<>();
     }
 
+    @SuppressWarnings( "deprecation" )
     public DefaultProjectBuildingRequest( ProjectBuildingRequest request )
     {
         this();
-        setProcessPlugins( request.isProcessPlugins() );
-        setProfiles( request.getProfiles() );
         setActiveProfileIds( request.getActiveProfileIds() );
+        setBuildStartTime( request.getBuildStartTime() );
         setInactiveProfileIds( request.getInactiveProfileIds() );
-        setSystemProperties( request.getSystemProperties() );
-        setUserProperties( request.getUserProperties() );
-        setRemoteRepositories( request.getRemoteRepositories() );
-        setPluginArtifactRepositories( request.getPluginArtifactRepositories() 
);
-        setRepositorySession( request.getRepositorySession() );
         setLocalRepository( request.getLocalRepository() );
-        setBuildStartTime( request.getBuildStartTime() );
+        setPluginArtifactRepositories( request.getPluginArtifactRepositories() 
);
+        setProcessPlugins( request.isProcessPlugins() );
+        setProfiles( request.getProfiles() );
         setProject( request.getProject() );
+        setRemoteRepositories( request.getRemoteRepositories() );
+        setRepositoryMerging( request.getRepositoryMerging() );
+        setRepositorySession( request.getRepositorySession() );
         setResolveDependencies( request.isResolveDependencies() );
+        setResolveVersionRanges( request.isResolveVersionRanges() );
+        setSystemProperties( request.getSystemProperties() );
+        setUserProperties( request.getUserProperties() );
         setValidationLevel( request.getValidationLevel() );
     }
 

http://git-wip-us.apache.org/repos/asf/maven/blob/def2738a/maven-core/src/main/java/org/apache/maven/project/ProjectModelResolver.java
----------------------------------------------------------------------
diff --git 
a/maven-core/src/main/java/org/apache/maven/project/ProjectModelResolver.java 
b/maven-core/src/main/java/org/apache/maven/project/ProjectModelResolver.java
index f11e77d..526e54d 100644
--- 
a/maven-core/src/main/java/org/apache/maven/project/ProjectModelResolver.java
+++ 
b/maven-core/src/main/java/org/apache/maven/project/ProjectModelResolver.java
@@ -79,6 +79,8 @@ public class ProjectModelResolver
 
     private final Set<String> repositoryIds;
 
+    private final Set<String> externalRepositoryIds;
+
     private final ReactorModelPool modelPool;
 
     private final ProjectBuildingRequest.RepositoryMerging repositoryMerging;
@@ -100,7 +102,13 @@ public class ProjectModelResolver
         this.repositories.addAll( externalRepositories );
         this.repositoryMerging = repositoryMerging;
         this.repositoryIds = new HashSet<>();
+        this.externalRepositoryIds = new HashSet<>();
         this.modelPool = modelPool;
+        for ( final RemoteRepository repository : repositories )
+        {
+            this.repositoryIds.add( repository.getId() );
+            this.externalRepositoryIds.add( repository.getId() );
+        }
     }
 
     private ProjectModelResolver( ProjectModelResolver original )
@@ -114,6 +122,7 @@ public class ProjectModelResolver
         this.repositories = new ArrayList<>( original.repositories );
         this.repositoryMerging = original.repositoryMerging;
         this.repositoryIds = new HashSet<>( original.repositoryIds );
+        this.externalRepositoryIds = new HashSet<>( 
original.externalRepositoryIds );
         this.modelPool = original.modelPool;
     }
 
@@ -129,7 +138,8 @@ public class ProjectModelResolver
     {
         if ( !repositoryIds.add( repository.getId() ) )
         {
-            if ( !replace )
+            if ( !replace || ( 
ProjectBuildingRequest.RepositoryMerging.REQUEST_DOMINANT.equals( 
repositoryMerging )
+                               && this.externalRepositoryIds.contains( 
repository.getId() ) ) )
             {
                 return;
             }

Reply via email to