mirror of https://github.com/apache/maven.git
o Fixed aggregation of remote repositories
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@782231 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
73f3c915d1
commit
b273dab333
|
@ -21,7 +21,9 @@ package org.apache.maven.project;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
|
@ -88,7 +90,19 @@ class RepositoryModelResolver
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArtifactRepository repo = repositorySystem.buildArtifactRepository( repository );
|
ArtifactRepository repo = repositorySystem.buildArtifactRepository( repository );
|
||||||
remoteRepositories.addAll( 0, repositorySystem.getMirrors( Arrays.asList( repo ) ) );
|
|
||||||
|
ArtifactRepository mirror = repositorySystem.getMirrors( Arrays.asList( repo ) ).get( 0 );
|
||||||
|
|
||||||
|
for ( Iterator<ArtifactRepository> it = remoteRepositories.iterator(); it.hasNext(); )
|
||||||
|
{
|
||||||
|
ArtifactRepository remoteRepository = it.next();
|
||||||
|
if ( mirror.getId().equals( remoteRepository.getId() ) )
|
||||||
|
{
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
remoteRepositories.add( 0, mirror );
|
||||||
}
|
}
|
||||||
catch ( org.apache.maven.artifact.InvalidRepositoryException e )
|
catch ( org.apache.maven.artifact.InvalidRepositoryException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,9 +33,25 @@ import org.apache.maven.model.Repository;
|
||||||
public interface ModelResolver
|
public interface ModelResolver
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to resolve the POM for the specified coordinates.
|
||||||
|
*
|
||||||
|
* @param groupId The group identifier of the POM, must not be {@code null}.
|
||||||
|
* @param artifactId The artifact identifier of the POM, must not be {@code null}.
|
||||||
|
* @param version The version of the POM, must not be {@code null}.
|
||||||
|
* @return The source of the requested POM, never {@code null}.
|
||||||
|
* @throws UnresolvableModelException If the POM could not be resolved from any configured repository.
|
||||||
|
*/
|
||||||
ModelSource resolveModel( String groupId, String artifactId, String version )
|
ModelSource resolveModel( String groupId, String artifactId, String version )
|
||||||
throws UnresolvableModelException;
|
throws UnresolvableModelException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a repository to use for subsequent resolution requests. The order in which repositories are added matters.
|
||||||
|
* When multiple repositories with the same identifier are added, only the last repository being added will be used.
|
||||||
|
*
|
||||||
|
* @param repository The repository to add to the internal search chain, must not be {@code null}.
|
||||||
|
* @throws InvalidRepositoryException If the repository could not be added (e.g. due to invalid URL or layout).
|
||||||
|
*/
|
||||||
void addRepository( Repository repository )
|
void addRepository( Repository repository )
|
||||||
throws InvalidRepositoryException;
|
throws InvalidRepositoryException;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue