mirror of https://github.com/apache/maven.git
restore more backward comp.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@944465 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
35e842ab22
commit
7f42e485ca
|
@ -23,9 +23,12 @@ import java.util.List;
|
|||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
|
||||
import org.apache.maven.execution.MavenExecutionRequest;
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.plugin.LegacySupport;
|
||||
import org.apache.maven.repository.MirrorSelector;
|
||||
import org.apache.maven.settings.Mirror;
|
||||
import org.apache.maven.settings.Proxy;
|
||||
import org.apache.maven.settings.Server;
|
||||
import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest;
|
||||
|
@ -37,6 +40,7 @@ import org.apache.maven.wagon.authentication.AuthenticationInfo;
|
|||
import org.apache.maven.wagon.proxy.ProxyInfo;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
import org.codehaus.plexus.logging.Logger;
|
||||
|
||||
@Component(role=WagonManager.class)
|
||||
public class DefaultWagonManager
|
||||
|
@ -44,12 +48,21 @@ public class DefaultWagonManager
|
|||
implements WagonManager
|
||||
{
|
||||
|
||||
@Requirement
|
||||
private Logger logger;
|
||||
|
||||
@Requirement
|
||||
private LegacySupport legacySupport;
|
||||
|
||||
@Requirement
|
||||
private SettingsDecrypter settingsDecrypter;
|
||||
|
||||
@Requirement
|
||||
private MirrorSelector mirrorSelector;
|
||||
|
||||
@Requirement
|
||||
private ArtifactRepositoryFactory artifactRepositoryFactory;
|
||||
|
||||
public AuthenticationInfo getAuthenticationInfo( String id )
|
||||
{
|
||||
MavenSession session = legacySupport.getSession();
|
||||
|
@ -141,4 +154,28 @@ public class DefaultWagonManager
|
|||
getArtifact( artifact, remoteRepositories, null, false );
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ArtifactRepository getMirrorRepository( ArtifactRepository repository )
|
||||
{
|
||||
|
||||
Mirror mirror = mirrorSelector.getMirror( repository, legacySupport.getSession().getSettings().getMirrors() );
|
||||
|
||||
if ( mirror != null )
|
||||
{
|
||||
String id = mirror.getId();
|
||||
if ( id == null )
|
||||
{
|
||||
// TODO: this should be illegal in settings.xml
|
||||
id = repository.getId();
|
||||
}
|
||||
|
||||
logger.debug( "Using mirror: " + mirror.getUrl() + " (id: " + id + ")" );
|
||||
|
||||
repository = artifactRepositoryFactory.createArtifactRepository( id, mirror.getUrl(),
|
||||
repository.getLayout(), repository.getSnapshots(),
|
||||
repository.getReleases() );
|
||||
}
|
||||
return repository;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -53,4 +53,6 @@ public interface WagonManager
|
|||
void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepositories )
|
||||
throws TransferFailedException, ResourceDoesNotExistException;
|
||||
|
||||
ArtifactRepository getMirrorRepository( ArtifactRepository repository );
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,8 @@ import org.apache.maven.artifact.Artifact;
|
|||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
|
||||
import org.apache.maven.repository.MirrorSelector;
|
||||
import org.apache.maven.settings.Mirror;
|
||||
import org.apache.maven.wagon.ConnectionException;
|
||||
import org.apache.maven.wagon.ResourceDoesNotExistException;
|
||||
import org.apache.maven.wagon.TransferFailedException;
|
||||
|
@ -72,6 +74,7 @@ public class DefaultWagonManager
|
|||
@Requirement
|
||||
private UpdateCheckManager updateCheckManager;
|
||||
|
||||
|
||||
//
|
||||
// Retriever
|
||||
//
|
||||
|
@ -758,4 +761,5 @@ public class DefaultWagonManager
|
|||
|
||||
return wagon;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue