diff options
Diffstat (limited to 'archiva-modules/plugins/maven2-repository')
-rw-r--r-- | archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java index 2c7bfb2b8..934cb33f6 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java @@ -262,7 +262,7 @@ public class RepositoryModelResolver String metadataPath = StringUtils.substringBeforeLast( artifactPath, "/" ) + "/" + METADATA_FILENAME; - wagon.get( metadataPath, tmpMetadataResource ); + wagon.get( addParameters( metadataPath, remoteRepository ), tmpMetadataResource ); log.debug( "Successfully downloaded metadata." ); @@ -288,7 +288,7 @@ public class RepositoryModelResolver log.info( "Retrieving {} from {}", artifactPath, remoteRepository.getName() ); - wagon.get( artifactPath, tmpResource ); + wagon.get( addParameters( artifactPath, remoteRepository ), tmpResource ); log.debug( "Downloaded successfully." ); @@ -426,7 +426,7 @@ public class RepositoryModelResolver log.info( "Retrieving {} from {}", remotePath, remoteRepository.getName() ); - wagon.get( remotePath, destFile ); + wagon.get( addParameters( remotePath, remoteRepository ), destFile ); log.debug( "Downloaded successfully." ); @@ -485,4 +485,26 @@ public class RepositoryModelResolver } } } + + protected String addParameters( String path, RemoteRepository remoteRepository ) + { + if ( remoteRepository.getExtraParameters().isEmpty() ) + { + return path; + } + + boolean question = false; + + StringBuilder res = new StringBuilder( path == null ? "" : path ); + + for ( Map.Entry<String, String> entry : remoteRepository.getExtraParameters().entrySet() ) + { + if ( !question ) + { + res.append( '?' ).append( entry.getKey() ).append( '=' ).append( entry.getValue() ); + } + } + + return res.toString(); + } } |