diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java index 0974f27641..2e411f4d14 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java @@ -105,6 +105,8 @@ public class DefaultMavenExecutionRequest private List remoteRepositories; + private List pluginArtifactRepositories; + /** * Suppress SNAPSHOT updates. * @@ -144,6 +146,7 @@ public class DefaultMavenExecutionRequest copy.setGlobalChecksumPolicy( original.getGlobalChecksumPolicy() ); copy.setUpdateSnapshots( original.isUpdateSnapshots() ); copy.setRemoteRepositories( original.getRemoteRepositories() ); + copy.setPluginArtifactRepositories( original.getPluginArtifactRepositories() ); copy.setNoSnapshotUpdates( original.isNoSnapshotUpdates() ); return original; } @@ -232,6 +235,14 @@ public class DefaultMavenExecutionRequest return this; } + public MavenExecutionRequest setPluginArtifactRepositories( List pluginArtifactRepositories ) + { + getPluginArtifactRepositories().clear(); + getPluginArtifactRepositories().addAll( pluginArtifactRepositories ); + + return this; + } + public void setProjectBuildingConfiguration( ProjectBuildingRequest projectBuildingConfiguration ) { this.projectBuildingRequest = projectBuildingConfiguration; @@ -705,6 +716,15 @@ public class DefaultMavenExecutionRequest return remoteRepositories; } + public List getPluginArtifactRepositories() + { + if ( pluginArtifactRepositories == null ) + { + pluginArtifactRepositories = new ArrayList(); + } + return pluginArtifactRepositories; + } + //TODO: this does not belong here. public ProjectBuildingRequest getProjectBuildingRequest() { @@ -714,6 +734,7 @@ public class DefaultMavenExecutionRequest projectBuildingRequest.setLocalRepository( getLocalRepository() ); projectBuildingRequest.setExecutionProperties( getProperties() ); projectBuildingRequest.setRemoteRepositories( getRemoteRepositories() ); + projectBuildingRequest.setPluginArtifactRepositories( getPluginArtifactRepositories() ); projectBuildingRequest.setActiveProfileIds( getActiveProfiles() ); projectBuildingRequest.setInactiveProfileIds( getInactiveProfiles() ); projectBuildingRequest.setProfiles( getProfiles() ); diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java index 5a37e73944..d782f31479 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java @@ -199,6 +199,9 @@ public interface MavenExecutionRequest MavenExecutionRequest setRemoteRepositories( List repositories ); List getRemoteRepositories(); + MavenExecutionRequest setPluginArtifactRepositories( List repositories ); + List getPluginArtifactRepositories(); + File getUserToolchainsFile(); MavenExecutionRequest setUserToolchainsFile( File userToolchainsFile ); 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 aec18c9657..bc78c9c7fb 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 @@ -35,6 +35,8 @@ public class DefaultProjectBuildingRequest private List remoteRepositories; + private List pluginArtifactRepositories; + private List listeners; private MavenProject topProject; @@ -60,6 +62,8 @@ public class DefaultProjectBuildingRequest activeProfileIds = new ArrayList(); inactiveProfileIds = new ArrayList(); executionProperties = new Properties(); + remoteRepositories = new ArrayList(); + pluginArtifactRepositories = new ArrayList(); } public MavenProject getTopLevelProjectFromReactor() @@ -85,16 +89,35 @@ public class DefaultProjectBuildingRequest public List getRemoteRepositories() { - if ( remoteRepositories == null ) - { - remoteRepositories = new ArrayList(); - } return remoteRepositories; } public ProjectBuildingRequest setRemoteRepositories( List remoteRepositories ) { - this.remoteRepositories = remoteRepositories; + this.remoteRepositories.clear(); + + if ( remoteRepositories != null ) + { + this.remoteRepositories.addAll( remoteRepositories ); + } + + return this; + } + + public List getPluginArtifactRepositories() + { + return pluginArtifactRepositories; + } + + public ProjectBuildingRequest setPluginArtifactRepositories( List pluginArtifactRepositories ) + { + this.pluginArtifactRepositories.clear(); + + if ( pluginArtifactRepositories != null ) + { + this.pluginArtifactRepositories.addAll( pluginArtifactRepositories ); + } + return this; } @@ -106,6 +129,7 @@ public class DefaultProjectBuildingRequest public ProjectBuildingRequest setExecutionProperties( Properties executionProperties ) { this.executionProperties.clear(); + if ( executionProperties != null ) { this.executionProperties.putAll( executionProperties ); @@ -155,6 +179,7 @@ public class DefaultProjectBuildingRequest public void setActiveProfileIds( List activeProfileIds ) { this.activeProfileIds.clear(); + if ( activeProfileIds != null ) { this.activeProfileIds.addAll( activeProfileIds ); @@ -169,6 +194,7 @@ public class DefaultProjectBuildingRequest public void setInactiveProfileIds( List inactiveProfileIds ) { this.inactiveProfileIds.clear(); + if ( inactiveProfileIds != null ) { this.inactiveProfileIds.addAll( inactiveProfileIds ); @@ -178,6 +204,7 @@ public class DefaultProjectBuildingRequest public void setProfiles( List profiles ) { this.profiles.clear(); + if ( profiles != null ) { this.profiles.addAll( profiles ); diff --git a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java index da1abda1f7..a3bf70273f 100644 --- a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java +++ b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java @@ -235,10 +235,12 @@ public class MavenProject this.repositorySystem = repositorySystem; originalModel = model; - remoteArtifactRepositories = - createArtifactRepositories( model.getRepositories(), projectBuilderConfiguration.getRemoteRepositories() ); + remoteArtifactRepositories = projectBuilderConfiguration.getRemoteRepositories(); + remoteArtifactRepositories = createArtifactRepositories( model.getRepositories(), remoteArtifactRepositories ); - pluginArtifactRepositories = createArtifactRepositories( model.getPluginRepositories(), null ); + pluginArtifactRepositories = projectBuilderConfiguration.getPluginArtifactRepositories(); + pluginArtifactRepositories = + createArtifactRepositories( model.getPluginRepositories(), pluginArtifactRepositories ); } //TODO: need to integrate the effective scope and refactor it out of the MMS diff --git a/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java b/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java index a1bc1a3bef..d2ad419902 100644 --- a/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java +++ b/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java @@ -17,6 +17,10 @@ public interface ProjectBuildingRequest List getRemoteRepositories(); + ProjectBuildingRequest setPluginArtifactRepositories( List pluginArtifacgRepositories ); + + List getPluginArtifactRepositories(); + ProjectBuildingRequest setExecutionProperties( Properties executionProperties ); Properties getExecutionProperties(); diff --git a/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java b/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java index 348d8431ad..824403a317 100644 --- a/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java +++ b/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java @@ -235,6 +235,8 @@ public class DefaultMavenExecutionRequestPopulator // request.setRemoteRepositories( repositorySystem.getMirrors( request.getRemoteRepositories() ) ); + + request.setPluginArtifactRepositories( repositorySystem.getMirrors( request.getPluginArtifactRepositories() ) ); } // ------------------------------------------------------------------------