[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/7cff1811 Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/7cff1811 Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/7cff1811 Branch: refs/heads/DEPMGMT Commit: 7cff1811a5765c206c5730ad15afbf55986ba851 Parents: fb32b72 Author: Christian Schulte <schu...@apache.org> Authored: Tue Dec 13 20:16:20 2016 +0100 Committer: Christian Schulte <schu...@apache.org> Committed: Wed Mar 8 18:39:52 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/7cff1811/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/7cff1811/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 3a31d33..531ae0b 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 @@ -78,6 +78,8 @@ public class ProjectModelResolver private final Set<String> repositoryIds; + private final Set<String> externalRepositoryIds; + private final ReactorModelPool modelPool; private final ProjectBuildingRequest.RepositoryMerging repositoryMerging; @@ -99,7 +101,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 ) @@ -113,6 +121,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; } @@ -128,7 +137,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; }