}
catch ( ResourceDoesNotExistException e )
{
- //@todo usage for cacheFailure
+ //@todo usage for cacheFailure
//do nothing, file not found in this repository
}
catch ( AuthorizationException e )
boolean connected = false;
try
{
- wagon.connect( repository );
+ wagon.connect( repository, repository.getProxy() );
connected = true;
}
catch ( ConnectionException e )
repo.setCacheFailures( repoConfig.getCacheFailures() );
repo.setCachePeriod( repoConfig.getCachePeriod() );
+ if ( repoConfig instanceof HttpRepoConfiguration )
+ {
+ HttpRepoConfiguration httpRepo = (HttpRepoConfiguration) repoConfig;
+ MavenProxyConfiguration httpProxy = httpRepo.getProxy();
+ repo.setProxy( httpProxy.getHost(), httpProxy.getPort(),
+ httpProxy.getUsername(), httpProxy.getPassword() );
+ }
+
repoList.add( repo );
}
}
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.wagon.proxy.ProxyInfo;
/**
* Class to represent the Proxy repository. Currently does not provide additional methods from
private boolean cacheFailures = false;
+ private ProxyInfo proxy;
+
public ProxyRepository( String id, String url, ArtifactRepositoryLayout layout, boolean cacheFailures,
long cachePeriod )
{
{
this.cacheFailures = cacheFailures;
}
+
+ public boolean isProxied()
+ {
+ return ( proxy != null );
+ }
+
+ public ProxyInfo getProxy()
+ {
+ return proxy;
+ }
+
+ public void setProxy( String host, int port )
+ {
+ ProxyInfo proxyInfo = new ProxyInfo();
+ proxyInfo.setHost( host );
+ proxyInfo.setPort( port );
+
+ setProxy( proxyInfo );
+ }
+
+ public void setProxy( String host, int port, String username, String password )
+ {
+ ProxyInfo proxyInfo = new ProxyInfo();
+ proxyInfo.setHost( host );
+ proxyInfo.setPort( port );
+ proxyInfo.setUserName( username );
+ proxyInfo.setPassword( password );
+
+ setProxy( proxyInfo );
+ }
+
+ public void setProxy( String host, int port, String username, String password, String ntlmHost, String ntlmDomain )
+ {
+ ProxyInfo proxyInfo = new ProxyInfo();
+ proxyInfo.setHost( host );
+ proxyInfo.setPort( port );
+ proxyInfo.setUserName( username );
+ proxyInfo.setPassword( password );
+ proxyInfo.setNtlmHost( ntlmHost );
+ proxyInfo.setNtlmDomain( ntlmDomain );
+
+ setProxy( proxyInfo );
+ }
+
+ public void setProxy( ProxyInfo proxy )
+ {
+ this.proxy = proxy;
+ }
}
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;\r
import org.apache.maven.artifact.repository.layout.LegacyRepositoryLayout;\r
import org.apache.maven.repository.proxy.repository.ProxyRepository;\r
+import org.apache.maven.wagon.proxy.ProxyInfo;\r
import org.codehaus.plexus.PlexusTestCase;\r
import org.codehaus.plexus.util.FileUtils;\r
\r
ProxyRepository repo2 = new ProxyRepository( "repo2", "http://www.ibiblio.org/maven", legacyLayout );\r
repo2.setCacheFailures( false );\r
repo2.setCachePeriod( 3600 );\r
+ repo2.setProxy( "some.local.proxy", 80, "username", "password" );\r
config.addRepository( repo2 );\r
assertEquals( 2, config.getRepositories().size() );\r
\r
assertFalse( repo.isCacheFailures() );\r
assertEquals( 3600, repo.getCachePeriod() );\r
assertEquals( repo2, repo );\r
+ assertTrue( repo.isProxied() );\r
+ ProxyInfo proxyInfo = repo.getProxy();\r
+ assertNotNull( proxyInfo );\r
+ assertEquals( "some.local.proxy", proxyInfo.getHost() );\r
+ assertEquals( 80, proxyInfo.getPort() );\r
+ assertEquals( "username", proxyInfo.getUserName() );\r
+ assertEquals( "password", proxyInfo.getPassword() );\r
\r
try\r
{\r