You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by si...@apache.org on 2009/04/22 01:11:41 UTC

svn commit: r767327 - in /maven/components/trunk: maven-core/src/test/java/org/apache/maven/settings/ maven-core/src/test/resources-settings/repositories/ maven-embedder/src/main/java/org/apache/maven/embedder/execution/

Author: sisbell
Date: Tue Apr 21 23:11:40 2009
New Revision: 767327

URL: http://svn.apache.org/viewvc?rev=767327&view=rev
Log:
[MNG-3983, 2068, 836] - the plugin repositories from settings files were not being picked up.

Added:
    maven/components/trunk/maven-core/src/test/resources-settings/repositories/
    maven/components/trunk/maven-core/src/test/resources-settings/repositories/pom.xml
    maven/components/trunk/maven-core/src/test/resources-settings/repositories/settings.xml
Modified:
    maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java
    maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java

Modified: maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java?rev=767327&r1=767326&r2=767327&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java (original)
+++ maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java Tue Apr 21 23:11:40 2009
@@ -55,6 +55,14 @@
     	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

Added: maven/components/trunk/maven-core/src/test/resources-settings/repositories/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/resources-settings/repositories/pom.xml?rev=767327&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/test/resources-settings/repositories/pom.xml (added)
+++ maven/components/trunk/maven-core/src/test/resources-settings/repositories/pom.xml Tue Apr 21 23:11:40 2009
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng4107</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+</project>

Added: maven/components/trunk/maven-core/src/test/resources-settings/repositories/settings.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/resources-settings/repositories/settings.xml?rev=767327&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/test/resources-settings/repositories/settings.xml (added)
+++ maven/components/trunk/maven-core/src/test/resources-settings/repositories/settings.xml Tue Apr 21 23:11:40 2009
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<settings>
+  <profiles>
+    <profile>
+      <id>maven-core-it-repo</id>
+      <repositories>
+        <repository>
+          <id>maven-core-it-0</id>
+          <url>@baseurl@/repo-0</url>
+          <releases>
+            <checksumPolicy>ignore</checksumPolicy>
+          </releases>
+          <snapshots>
+            <enabled>false</enabled>
+          </snapshots>
+        </repository>
+      </repositories>
+      <pluginRepositories>
+        <pluginRepository>
+          <id>maven-core-it-1</id>
+          <url>@baseurl@/repo-1</url>
+          <releases>
+            <checksumPolicy>ignore</checksumPolicy>
+          </releases>
+          <snapshots>
+            <checksumPolicy>ignore</checksumPolicy>
+          </snapshots>
+        </pluginRepository>
+      </pluginRepositories>
+    </profile>
+  </profiles>
+  <activeProfiles>
+    <activeProfile>maven-core-it-repo</activeProfile>
+  </activeProfiles>
+</settings>

Modified: maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java?rev=767327&r1=767326&r2=767327&view=diff
==============================================================================
--- maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java (original)
+++ maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java Tue Apr 21 23:11:40 2009
@@ -220,6 +220,17 @@
                             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 )