[MNG-4036] [regression] Maven 3.x can't resolve parent POMs from repositories defined in settings.xml

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@744560 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-02-14 19:38:53 +00:00
parent 90e6b3ecb8
commit fda7685244
1 changed files with 7 additions and 27 deletions

View File

@ -27,6 +27,7 @@ import java.util.Properties;
import org.apache.maven.Maven; import org.apache.maven.Maven;
import org.apache.maven.MavenTools; import org.apache.maven.MavenTools;
import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
@ -190,6 +191,7 @@ public class DefaultMavenExecutionRequestPopulator
} }
private void processSettings( MavenExecutionRequest request, Configuration configuration ) private void processSettings( MavenExecutionRequest request, Configuration configuration )
throws MavenEmbedderException
{ {
ProfileManager profileManager = request.getProfileManager(); ProfileManager profileManager = request.getProfileManager();
@ -217,38 +219,16 @@ public class DefaultMavenExecutionRequestPopulator
{ {
Repository r = (Repository) j.next(); Repository r = (Repository) j.next();
ArtifactRepositoryPolicy releases = new ArtifactRepositoryPolicy(); ArtifactRepository ar;
try
if ( r.getReleases() != null )
{ {
releases.setChecksumPolicy( r.getReleases().getChecksumPolicy() ); ar = mavenTools.buildArtifactRepository( r );
releases.setUpdatePolicy( r.getReleases().getUpdatePolicy() );
} }
else catch ( InvalidRepositoryException e )
{ {
releases.setChecksumPolicy( ArtifactRepositoryPolicy.UPDATE_POLICY_DAILY ); throw new MavenEmbedderException( "Cannot create remote repository " + r.getId(), e );
releases.setUpdatePolicy( ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );
} }
ArtifactRepositoryPolicy snapshots = new ArtifactRepositoryPolicy();
if ( r.getSnapshots() != null )
{
snapshots.setChecksumPolicy( r.getSnapshots().getChecksumPolicy() );
snapshots.setUpdatePolicy( r.getSnapshots().getUpdatePolicy() );
}
else
{
snapshots.setChecksumPolicy( ArtifactRepositoryPolicy.UPDATE_POLICY_DAILY );
snapshots.setUpdatePolicy( ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );
}
ArtifactRepository ar = mavenTools.createRepository( r.getId(), r.getUrl(), snapshots, releases );
request.addRemoteRepository( ar ); request.addRemoteRepository( ar );
} }
} }