mirror of https://github.com/apache/maven.git
o Accounted for refactoring of aether-api
This commit is contained in:
parent
03b0269579
commit
2838745156
|
@ -74,6 +74,7 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti
|
|||
import org.codehaus.plexus.logging.Logger;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.eclipse.aether.RepositorySystemSession;
|
||||
import org.eclipse.aether.repository.AuthenticationContext;
|
||||
import org.eclipse.aether.repository.AuthenticationSelector;
|
||||
import org.eclipse.aether.repository.ProxySelector;
|
||||
import org.eclipse.aether.repository.RemoteRepository;
|
||||
|
@ -583,13 +584,17 @@ public class LegacyRepositorySystem
|
|||
AuthenticationSelector selector = session.getAuthenticationSelector();
|
||||
if ( selector != null )
|
||||
{
|
||||
org.eclipse.aether.repository.Authentication auth =
|
||||
selector.getAuthentication( RepositoryUtils.toRepo( repository ) );
|
||||
RemoteRepository repo = RepositoryUtils.toRepo( repository );
|
||||
org.eclipse.aether.repository.Authentication auth = selector.getAuthentication( repo );
|
||||
if ( auth != null )
|
||||
{
|
||||
Authentication result = new Authentication( auth.getUsername(), auth.getPassword() );
|
||||
result.setPrivateKey( auth.getPrivateKeyFile() );
|
||||
result.setPassphrase( auth.getPassphrase() );
|
||||
AuthenticationContext authCtx = AuthenticationContext.forRepository( session, repo );
|
||||
Authentication result =
|
||||
new Authentication( authCtx.get( AuthenticationContext.USERNAME ),
|
||||
authCtx.get( AuthenticationContext.PASSWORD ) );
|
||||
result.setPrivateKey( authCtx.get( AuthenticationContext.PRIVATE_KEY_PATH ) );
|
||||
result.setPassphrase( authCtx.get( AuthenticationContext.PRIVATE_KEY_PASSPHRASE ) );
|
||||
authCtx.close();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -688,7 +693,8 @@ public class LegacyRepositorySystem
|
|||
ProxySelector selector = session.getProxySelector();
|
||||
if ( selector != null )
|
||||
{
|
||||
org.eclipse.aether.repository.Proxy proxy = selector.getProxy( RepositoryUtils.toRepo( repository ) );
|
||||
RemoteRepository repo = RepositoryUtils.toRepo( repository );
|
||||
org.eclipse.aether.repository.Proxy proxy = selector.getProxy( repo );
|
||||
if ( proxy != null )
|
||||
{
|
||||
Proxy p = new Proxy();
|
||||
|
@ -697,8 +703,12 @@ public class LegacyRepositorySystem
|
|||
p.setPort( proxy.getPort() );
|
||||
if ( proxy.getAuthentication() != null )
|
||||
{
|
||||
p.setUserName( proxy.getAuthentication().getUsername() );
|
||||
p.setPassword( proxy.getAuthentication().getPassword() );
|
||||
AuthenticationContext authCtx = AuthenticationContext.forProxy( session, repo );
|
||||
p.setUserName( authCtx.get( AuthenticationContext.USERNAME ) );
|
||||
p.setPassword( authCtx.get( AuthenticationContext.PASSWORD ) );
|
||||
p.setNtlmDomain( authCtx.get( AuthenticationContext.NTLM_DOMAIN ) );
|
||||
p.setNtlmHost( authCtx.get( AuthenticationContext.NTLM_WORKSTATION ) );
|
||||
authCtx.close();
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,6 @@ import org.eclipse.aether.collection.DependencyGraphTransformer;
|
|||
import org.eclipse.aether.collection.DependencyManager;
|
||||
import org.eclipse.aether.collection.DependencySelector;
|
||||
import org.eclipse.aether.collection.DependencyTraverser;
|
||||
import org.eclipse.aether.repository.Authentication;
|
||||
import org.eclipse.aether.repository.LocalRepository;
|
||||
import org.eclipse.aether.repository.RepositoryPolicy;
|
||||
import org.eclipse.aether.repository.WorkspaceReader;
|
||||
|
@ -99,6 +98,7 @@ import org.eclipse.aether.util.graph.transformer.ConflictMarker;
|
|||
import org.eclipse.aether.util.graph.transformer.JavaDependencyContextRefiner;
|
||||
import org.eclipse.aether.util.graph.transformer.JavaEffectiveScopeCalculator;
|
||||
import org.eclipse.aether.util.graph.traverser.FatArtifactTraverser;
|
||||
import org.eclipse.aether.util.repository.AuthenticationBuilder;
|
||||
import org.eclipse.aether.util.repository.ChainedWorkspaceReader;
|
||||
import org.eclipse.aether.util.repository.DefaultAuthenticationSelector;
|
||||
import org.eclipse.aether.util.repository.DefaultMirrorSelector;
|
||||
|
@ -407,19 +407,21 @@ public class DefaultMaven
|
|||
DefaultProxySelector proxySelector = new DefaultProxySelector();
|
||||
for ( Proxy proxy : decrypted.getProxies() )
|
||||
{
|
||||
Authentication proxyAuth = new Authentication( proxy.getUsername(), proxy.getPassword() );
|
||||
proxySelector.add( new org.eclipse.aether.repository.Proxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(),
|
||||
proxyAuth ), proxy.getNonProxyHosts() );
|
||||
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
|
||||
authBuilder.username( proxy.getUsername() ).password( proxy.getPassword() );
|
||||
proxySelector.add( new org.eclipse.aether.repository.Proxy( proxy.getProtocol(), proxy.getHost(),
|
||||
proxy.getPort(), authBuilder.build() ),
|
||||
proxy.getNonProxyHosts() );
|
||||
}
|
||||
session.setProxySelector( proxySelector );
|
||||
|
||||
DefaultAuthenticationSelector authSelector = new DefaultAuthenticationSelector();
|
||||
for ( Server server : decrypted.getServers() )
|
||||
{
|
||||
Authentication auth =
|
||||
new Authentication( server.getUsername(), server.getPassword(), server.getPrivateKey(),
|
||||
server.getPassphrase() );
|
||||
authSelector.add( server.getId(), auth );
|
||||
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
|
||||
authBuilder.username( server.getUsername() ).password( server.getPassword() );
|
||||
authBuilder.privateKey( server.getPrivateKey(), server.getPassphrase() );
|
||||
authSelector.add( server.getId(), authBuilder.build() );
|
||||
|
||||
if ( server.getConfiguration() != null )
|
||||
{
|
||||
|
|
|
@ -44,6 +44,7 @@ import org.eclipse.aether.repository.Authentication;
|
|||
import org.eclipse.aether.repository.Proxy;
|
||||
import org.eclipse.aether.repository.RemoteRepository;
|
||||
import org.eclipse.aether.repository.RepositoryPolicy;
|
||||
import org.eclipse.aether.util.repository.AuthenticationBuilder;
|
||||
|
||||
/**
|
||||
* <strong>Warning:</strong> This is an internal utility class that is only public for technical reasons, it is not part
|
||||
|
@ -247,8 +248,10 @@ public class RepositoryUtils
|
|||
Authentication result = null;
|
||||
if ( auth != null )
|
||||
{
|
||||
result =
|
||||
new Authentication( auth.getUsername(), auth.getPassword(), auth.getPrivateKey(), auth.getPassphrase() );
|
||||
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
|
||||
authBuilder.username( auth.getUsername() ).password( auth.getPassword() );
|
||||
authBuilder.privateKey( auth.getPrivateKey(), auth.getPassphrase() );
|
||||
result = authBuilder.build();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -258,8 +261,9 @@ public class RepositoryUtils
|
|||
Proxy result = null;
|
||||
if ( proxy != null )
|
||||
{
|
||||
Authentication auth = new Authentication( proxy.getUserName(), proxy.getPassword() );
|
||||
result = new Proxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(), auth );
|
||||
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
|
||||
authBuilder.username( proxy.getUserName() ).password( proxy.getPassword() );
|
||||
result = new Proxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(), authBuilder.build() );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue