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.Artifact;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
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.MavenExecutionRequest;
|
||||||
import org.apache.maven.execution.MavenSession;
|
import org.apache.maven.execution.MavenSession;
|
||||||
import org.apache.maven.plugin.LegacySupport;
|
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.Proxy;
|
||||||
import org.apache.maven.settings.Server;
|
import org.apache.maven.settings.Server;
|
||||||
import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest;
|
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.apache.maven.wagon.proxy.ProxyInfo;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
import org.codehaus.plexus.component.annotations.Requirement;
|
import org.codehaus.plexus.component.annotations.Requirement;
|
||||||
|
import org.codehaus.plexus.logging.Logger;
|
||||||
|
|
||||||
@Component(role=WagonManager.class)
|
@Component(role=WagonManager.class)
|
||||||
public class DefaultWagonManager
|
public class DefaultWagonManager
|
||||||
|
@ -44,12 +48,21 @@ public class DefaultWagonManager
|
||||||
implements WagonManager
|
implements WagonManager
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@Requirement
|
||||||
|
private Logger logger;
|
||||||
|
|
||||||
@Requirement
|
@Requirement
|
||||||
private LegacySupport legacySupport;
|
private LegacySupport legacySupport;
|
||||||
|
|
||||||
@Requirement
|
@Requirement
|
||||||
private SettingsDecrypter settingsDecrypter;
|
private SettingsDecrypter settingsDecrypter;
|
||||||
|
|
||||||
|
@Requirement
|
||||||
|
private MirrorSelector mirrorSelector;
|
||||||
|
|
||||||
|
@Requirement
|
||||||
|
private ArtifactRepositoryFactory artifactRepositoryFactory;
|
||||||
|
|
||||||
public AuthenticationInfo getAuthenticationInfo( String id )
|
public AuthenticationInfo getAuthenticationInfo( String id )
|
||||||
{
|
{
|
||||||
MavenSession session = legacySupport.getSession();
|
MavenSession session = legacySupport.getSession();
|
||||||
|
@ -141,4 +154,28 @@ public class DefaultWagonManager
|
||||||
getArtifact( artifact, remoteRepositories, null, false );
|
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 )
|
void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepositories )
|
||||||
throws TransferFailedException, ResourceDoesNotExistException;
|
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.metadata.ArtifactMetadata;
|
||||||
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;
|
||||||
|
import org.apache.maven.repository.MirrorSelector;
|
||||||
|
import org.apache.maven.settings.Mirror;
|
||||||
import org.apache.maven.wagon.ConnectionException;
|
import org.apache.maven.wagon.ConnectionException;
|
||||||
import org.apache.maven.wagon.ResourceDoesNotExistException;
|
import org.apache.maven.wagon.ResourceDoesNotExistException;
|
||||||
import org.apache.maven.wagon.TransferFailedException;
|
import org.apache.maven.wagon.TransferFailedException;
|
||||||
|
@ -72,6 +74,7 @@ public class DefaultWagonManager
|
||||||
@Requirement
|
@Requirement
|
||||||
private UpdateCheckManager updateCheckManager;
|
private UpdateCheckManager updateCheckManager;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Retriever
|
// Retriever
|
||||||
//
|
//
|
||||||
|
@ -758,4 +761,5 @@ public class DefaultWagonManager
|
||||||
|
|
||||||
return wagon;
|
return wagon;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue