[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
This commit is contained in:
Britton Isbell 2009-04-21 23:11:40 +00:00
parent f53cbd5fbd
commit fcce49ff78
4 changed files with 103 additions and 0 deletions

View File

@ -56,6 +56,14 @@ public class PomConstructionWithSettingsTest
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
{

View File

@ -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>

View File

@ -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>

View File

@ -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 )