From fcce49ff781d448ef5b3156ee77f96ce61941029 Mon Sep 17 00:00:00 2001 From: Britton Isbell Date: Tue, 21 Apr 2009 23:11:40 +0000 Subject: [PATCH] [MNG-3983, 2068, 836] - the plugin repositories from settings files were not being picked up. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@767327 13f79535-47bb-0310-9956-ffa450edef68 --- .../PomConstructionWithSettingsTest.java | 8 +++ .../resources-settings/repositories/pom.xml | 29 ++++++++++ .../repositories/settings.xml | 55 +++++++++++++++++++ ...DefaultMavenExecutionRequestPopulator.java | 11 ++++ 4 files changed, 103 insertions(+) create mode 100644 maven-core/src/test/resources-settings/repositories/pom.xml create mode 100644 maven-core/src/test/resources-settings/repositories/settings.xml diff --git a/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java b/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java index 6696589e94..05055d1644 100644 --- a/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java +++ b/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java @@ -55,6 +55,14 @@ public class PomConstructionWithSettingsTest assertEquals("settings", pom.getValue( "properties/pomVsSettings" ) ); assertEquals("settings", pom.getValue( "properties/pomVsSettingsInterpolated" ) ); } + + /**MNG-4107 */ + public void testRepositories() throws Exception + { + PomTestWrapper pom = buildPom( "repositories" ); + assertEquals("maven-core-it-0", pom.getValue( "repositories[1]/id" )); + System.out.println(pom.getDomainModel().asString()); + } private PomTestWrapper buildPom( String pomPath ) throws Exception diff --git a/maven-core/src/test/resources-settings/repositories/pom.xml b/maven-core/src/test/resources-settings/repositories/pom.xml new file mode 100644 index 0000000000..97023414fb --- /dev/null +++ b/maven-core/src/test/resources-settings/repositories/pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4107 + test + 1.0-SNAPSHOT + jar + diff --git a/maven-core/src/test/resources-settings/repositories/settings.xml b/maven-core/src/test/resources-settings/repositories/settings.xml new file mode 100644 index 0000000000..6f96f0b6f8 --- /dev/null +++ b/maven-core/src/test/resources-settings/repositories/settings.xml @@ -0,0 +1,55 @@ + + + + + + + + maven-core-it-repo + + + maven-core-it-0 + @baseurl@/repo-0 + + ignore + + + false + + + + + + maven-core-it-1 + @baseurl@/repo-1 + + ignore + + + ignore + + + + + + + maven-core-it-repo + + 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 4ecdc69d1b..c18d7be6c2 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 @@ -220,6 +220,17 @@ public class DefaultMavenExecutionRequestPopulator throw new MavenEmbedderException( "Cannot create remote repository " + r.getId(), e ); } } + for ( Repository r : profile.getPluginRepositories() ) + { + try + { + request.addRemoteRepository( repositorySystem.buildArtifactRepository( r ) ); + } + catch ( InvalidRepositoryException e ) + { + throw new MavenEmbedderException( "Cannot create remote repository " + r.getId(), e ); + } + } } } catch ( ProfileActivationException e )