diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java index c4def8a1a3..85158037d6 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java @@ -49,11 +49,11 @@ public class ArtifactDescriptorUtils public static RemoteRepository toRemoteRepository( Repository repository ) { - RemoteRepository result = - new RemoteRepository( repository.getId(), repository.getLayout(), repository.getUrl() ); - result.setPolicy( true, toRepositoryPolicy( repository.getSnapshots() ) ); - result.setPolicy( false, toRepositoryPolicy( repository.getReleases() ) ); - return result; + RemoteRepository.Builder builder = + new RemoteRepository.Builder( repository.getId(), repository.getLayout(), repository.getUrl() ); + builder.setSnapshotPolicy( toRepositoryPolicy( repository.getSnapshots() ) ); + builder.setReleasePolicy( toRepositoryPolicy( repository.getReleases() ) ); + return builder.build(); } public static RepositoryPolicy toRepositoryPolicy( org.apache.maven.model.RepositoryPolicy policy ) diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java b/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java index 5905e084b4..abbab821a0 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java @@ -126,8 +126,10 @@ public class DefaultArtifactDeployer if ( deploymentRepository instanceof DefaultArtifactRepository && deploymentRepository.getAuthentication() == null ) { - remoteRepo.setAuthentication( session.getAuthenticationSelector().getAuthentication( remoteRepo ) ); - remoteRepo.setProxy( session.getProxySelector().getProxy( remoteRepo ) ); + RemoteRepository.Builder builder = new RemoteRepository.Builder( remoteRepo ); + builder.setAuthentication( session.getAuthenticationSelector().getAuthentication( remoteRepo ) ); + builder.setProxy( session.getProxySelector().getProxy( remoteRepo ) ); + remoteRepo = builder.build(); } request.setRepository( remoteRepo ); diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java index b6f3f491ac..0e2ca6494b 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java @@ -408,7 +408,7 @@ public class DefaultMaven for ( Proxy proxy : decrypted.getProxies() ) { AuthenticationBuilder authBuilder = new AuthenticationBuilder(); - authBuilder.username( proxy.getUsername() ).password( proxy.getPassword() ); + authBuilder.addUsername( proxy.getUsername() ).addPassword( proxy.getPassword() ); proxySelector.add( new org.eclipse.aether.repository.Proxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(), authBuilder.build() ), proxy.getNonProxyHosts() ); @@ -419,8 +419,8 @@ public class DefaultMaven for ( Server server : decrypted.getServers() ) { AuthenticationBuilder authBuilder = new AuthenticationBuilder(); - authBuilder.username( server.getUsername() ).password( server.getPassword() ); - authBuilder.privateKey( server.getPrivateKey(), server.getPassphrase() ); + authBuilder.addUsername( server.getUsername() ).addPassword( server.getPassword() ); + authBuilder.addPrivateKey( server.getPrivateKey(), server.getPassphrase() ); authSelector.add( server.getId(), authBuilder.build() ); if ( server.getConfiguration() != null ) diff --git a/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java b/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java index f07a377cf7..9b68a2e62e 100644 --- a/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java +++ b/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java @@ -198,12 +198,14 @@ public class RepositoryUtils RemoteRepository result = null; if ( repo != null ) { - result = new RemoteRepository( repo.getId(), getLayout( repo ), repo.getUrl() ); - result.setPolicy( true, toPolicy( repo.getSnapshots() ) ); - result.setPolicy( false, toPolicy( repo.getReleases() ) ); - result.setAuthentication( toAuthentication( repo.getAuthentication() ) ); - result.setProxy( toProxy( repo.getProxy() ) ); - result.setMirroredRepositories( toRepos( repo.getMirroredRepositories() ) ); + RemoteRepository.Builder builder = + new RemoteRepository.Builder( repo.getId(), getLayout( repo ), repo.getUrl() ); + builder.setSnapshotPolicy( toPolicy( repo.getSnapshots() ) ); + builder.setReleasePolicy( toPolicy( repo.getReleases() ) ); + builder.setAuthentication( toAuthentication( repo.getAuthentication() ) ); + builder.setProxy( toProxy( repo.getProxy() ) ); + builder.setMirroredRepositories( toRepos( repo.getMirroredRepositories() ) ); + result = builder.build(); } return result; } @@ -249,8 +251,8 @@ public class RepositoryUtils if ( auth != null ) { AuthenticationBuilder authBuilder = new AuthenticationBuilder(); - authBuilder.username( auth.getUsername() ).password( auth.getPassword() ); - authBuilder.privateKey( auth.getPrivateKey(), auth.getPassphrase() ); + authBuilder.addUsername( auth.getUsername() ).addPassword( auth.getPassword() ); + authBuilder.addPrivateKey( auth.getPrivateKey(), auth.getPassphrase() ); result = authBuilder.build(); } return result; @@ -262,7 +264,7 @@ public class RepositoryUtils if ( proxy != null ) { AuthenticationBuilder authBuilder = new AuthenticationBuilder(); - authBuilder.username( proxy.getUserName() ).password( proxy.getPassword() ); + authBuilder.addUsername( proxy.getUserName() ).addPassword( proxy.getPassword() ); result = new Proxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(), authBuilder.build() ); } return result;