mirror of https://github.com/apache/maven.git
PR: MNG-440
add proxy support, both as a nested element or if not given there, as a settings.xml entry git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@189490 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
223d37a7ad
commit
f028275f61
|
@ -65,14 +65,22 @@ public abstract class AbstractArtifactTask
|
|||
ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE,
|
||||
repository.getLayout() );
|
||||
|
||||
WagonManager manager = (WagonManager) lookup( WagonManager.ROLE );
|
||||
|
||||
Authentication authentication = repository.getAuthentication();
|
||||
if ( authentication != null )
|
||||
{
|
||||
WagonManager manager = (WagonManager) lookup( WagonManager.ROLE );
|
||||
manager.addAuthenticationInfo( "remote", authentication.getUserName(), authentication.getPassword(),
|
||||
authentication.getPrivateKey(), authentication.getPassphrase() );
|
||||
}
|
||||
|
||||
Proxy proxy = repository.getProxy();
|
||||
if ( proxy != null )
|
||||
{
|
||||
manager.addProxy( proxy.getType(), proxy.getHost(), proxy.getPort(), proxy.getUserName(),
|
||||
proxy.getPassword(), proxy.getNonProxyHosts() );
|
||||
}
|
||||
|
||||
ArtifactRepository artifactRepository;
|
||||
if ( repository.getSnapshotPolicy() != null )
|
||||
{
|
||||
|
@ -201,6 +209,13 @@ public abstract class AbstractArtifactTask
|
|||
{
|
||||
r.addAuthentication( new Authentication( server ) );
|
||||
}
|
||||
|
||||
org.apache.maven.settings.Proxy proxy = getSettings().getActiveProxy();
|
||||
if ( proxy != null )
|
||||
{
|
||||
r.addProxy( new Proxy( proxy ) );
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,8 @@ public class RemoteRepository
|
|||
|
||||
private String snapshotPolicy;
|
||||
|
||||
private Proxy proxy;
|
||||
|
||||
public String getUrl()
|
||||
{
|
||||
return ( (RemoteRepository) getInstance() ).url;
|
||||
|
@ -60,4 +62,14 @@ public class RemoteRepository
|
|||
{
|
||||
return snapshotPolicy;
|
||||
}
|
||||
|
||||
public void addProxy( Proxy proxy )
|
||||
{
|
||||
this.proxy = proxy;
|
||||
}
|
||||
|
||||
public Proxy getProxy()
|
||||
{
|
||||
return proxy;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,5 +9,6 @@
|
|||
<typedef name="localRepository" classname="org.apache.maven.artifact.ant.LocalRepository"/>
|
||||
<typedef name="remoteRepository" classname="org.apache.maven.artifact.ant.RemoteRepository"/>
|
||||
<typedef name="authentication" classname="org.apache.maven.artifact.ant.Authentication"/>
|
||||
<typedef name="proxy" classname="org.apache.maven.artifact.ant.Proxy"/>
|
||||
<typedef name="pom" classname="org.apache.maven.artifact.ant.Pom"/>
|
||||
</antlib>
|
||||
|
|
Loading…
Reference in New Issue