Index: src/main/java/org/apache/maven/artifact/ant/AbstractArtifactTask.java =================================================================== --- src/main/java/org/apache/maven/artifact/ant/AbstractArtifactTask.java (revision 1085345) +++ src/main/java/org/apache/maven/artifact/ant/AbstractArtifactTask.java Tue Sep 13 13:40:56 CDT 2011 @@ -298,7 +298,25 @@ { wagonManager.setOnline( true ); } + // initialize wagon manager from settings to ensure mirrors are known + List mirrors = settings.getMirrors(); + for (Mirror mirror : mirrors) + { + wagonManager.addMirror(mirror.getId(), mirror.getMirrorOf(), mirror.getUrl()); - } + } + List proxies = settings.getProxies(); + for (org.apache.maven.settings.Proxy proxy : proxies) + { + wagonManager.addProxy(proxy.getProtocol(), proxy.getHost(), proxy.getPort(), proxy.getUsername(), + proxy.getPassword(), proxy.getNonProxyHosts()); + } + List servers = settings.getServers(); + for (Server server : servers) + { + wagonManager.addAuthenticationInfo(server.getId(), server.getUsername(), server.getPassword(), + server.getPrivateKey(), server.getPassphrase()); + } + } private Settings loadSettings( File settingsFile ) { @@ -418,38 +436,6 @@ return r; } - protected void updateRepositoryWithSettings( RemoteRepository repository ) - { - // TODO: actually, we need to not funnel this through the ant repository - we should pump settings into wagon - // manager at the start like m2 does, and then match up by repository id - // As is, this could potentially cause a problem with 2 remote repositories with different authentication info - - Mirror mirror = getMirror( getSettings().getMirrors(), repository ); - if ( mirror != null ) - { - repository.setUrl( mirror.getUrl() ); - repository.setId( mirror.getId() ); - } - - if ( repository.getAuthentication() == null ) - { - Server server = getSettings().getServer( repository.getId() ); - if ( server != null ) - { - repository.addAuthentication( new Authentication( server ) ); - } - } - - if ( repository.getProxy() == null ) - { - org.apache.maven.settings.Proxy proxy = getSettings().getActiveProxy(); - if ( proxy != null ) - { - repository.addProxy( new Proxy( proxy ) ); - } - } - } - protected Object lookup( String role ) { try Index: src/main/java/org/apache/maven/artifact/ant/AbstractArtifactWithRepositoryTask.java =================================================================== --- src/main/java/org/apache/maven/artifact/ant/AbstractArtifactWithRepositoryTask.java (revision 1068543) +++ src/main/java/org/apache/maven/artifact/ant/AbstractArtifactWithRepositoryTask.java Wed Sep 14 13:44:13 CDT 2011 @@ -109,7 +109,6 @@ // repository id already added to the list: ignore it, since it has been overridden continue; } - updateRepositoryWithSettings( remoteRepository ); StringBuffer msg = new StringBuffer(); msg.append( " - id=" + remoteRepository.getId() ); Index: src/main/java/org/apache/maven/artifact/ant/DeployTask.java =================================================================== --- src/main/java/org/apache/maven/artifact/ant/DeployTask.java (revision 928113) +++ src/main/java/org/apache/maven/artifact/ant/DeployTask.java Wed Sep 14 13:44:23 CDT 2011 @@ -59,8 +59,6 @@ repository.setId( "remote" ); } - updateRepositoryWithSettings( repository ); - ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, repository.getLayout() );