diff --git a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java index 8490362c50..142f4008ec 100644 --- a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java +++ b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java @@ -134,12 +134,15 @@ public class DefaultRepositoryMetadataManager ArtifactRepository deploymentRepository ) throws ArtifactMetadataRetrievalException { + getLogger().info( "Retrieving previous metadata from " + deploymentRepository.getId() ); + resolveAlways( metadata, localRepository, deploymentRepository ); + metadata.storeInLocalRepository( localRepository, deploymentRepository ); - // TODO: shouldn't need to calculate this - File f = new File( localRepository.getBasedir(), - localRepository.pathOfLocalRepositoryMetadata( metadata, deploymentRepository ) ); + try { + File f = new File( localRepository.getBasedir(), + localRepository.pathOfLocalRepositoryMetadata( metadata, deploymentRepository ) ); wagonManager.putArtifactMetadata( f, metadata, deploymentRepository ); } catch ( TransferFailedException e ) diff --git a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/LatestArtifactTransformation.java b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/LatestArtifactTransformation.java index ddd58639b7..7bd4aa730a 100644 --- a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/LatestArtifactTransformation.java +++ b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/LatestArtifactTransformation.java @@ -17,7 +17,6 @@ package org.apache.maven.artifact.transform; */ import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadata; import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; import org.apache.maven.artifact.metadata.LatestArtifactMetadata; import org.apache.maven.artifact.metadata.LegacyArtifactMetadata; @@ -46,14 +45,14 @@ public class LatestArtifactTransformation public void transformForInstall( Artifact artifact, ArtifactRepository localRepository ) throws ArtifactMetadataRetrievalException { - // metadata is added at install time + // metadata is added via addPluginArtifactMetadata } public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository, ArtifactRepository localRepository ) throws ArtifactMetadataRetrievalException { - // metadata is added at deploy time + // metadata is added via addPluginArtifactMetadata } protected LegacyArtifactMetadata createLegacyMetadata( Artifact artifact ) @@ -61,13 +60,6 @@ public class LatestArtifactTransformation return new LatestArtifactMetadata( artifact ); } - protected ArtifactMetadata createMetadata( Artifact artifact, Versioning versioning ) - { - LatestArtifactMetadata metadata = new LatestArtifactMetadata( artifact ); - metadata.setVersion( versioning.getLatest() ); - return metadata; - } - protected String constructVersion( Versioning versioning, String baseVersion ) { return versioning.getLatest(); diff --git a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ReleaseArtifactTransformation.java b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ReleaseArtifactTransformation.java index 5635c16427..11c8f23ca5 100644 --- a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ReleaseArtifactTransformation.java +++ b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ReleaseArtifactTransformation.java @@ -56,16 +56,7 @@ public class ReleaseArtifactTransformation public void transformForInstall( Artifact artifact, ArtifactRepository localRepository ) throws ArtifactMetadataRetrievalException { - Versioning versioning = new Versioning(); - versioning.addVersion( artifact.getVersion() ); - - if ( artifact.isRelease() ) - { - versioning.setRelease( artifact.getVersion() ); - } - - // TODO: need to create? - ArtifactMetadata metadata = new ArtifactRepositoryMetadata( artifact, versioning ); + ArtifactMetadata metadata = createMetadata( artifact ); artifact.addMetadata( metadata ); } @@ -73,6 +64,13 @@ public class ReleaseArtifactTransformation public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository, ArtifactRepository localRepository ) throws ArtifactMetadataRetrievalException + { + ArtifactMetadata metadata = createMetadata( artifact ); + + artifact.addMetadata( metadata ); + } + + private ArtifactMetadata createMetadata( Artifact artifact ) { Versioning versioning = new Versioning(); versioning.addVersion( artifact.getVersion() ); @@ -82,14 +80,7 @@ public class ReleaseArtifactTransformation versioning.setRelease( artifact.getVersion() ); } - // TODO: need to create? - ArtifactMetadata metadata = new ArtifactRepositoryMetadata( artifact, versioning ); - - artifact.addMetadata( metadata ); - - // TODO: this should be in the part that actually merges instead - getLogger().info( "Retrieving previous metadata from " + remoteRepository.getId() ); - repositoryMetadataManager.resolveAlways( metadata, localRepository, remoteRepository ); + return new ArtifactRepositoryMetadata( artifact, versioning ); } protected LegacyArtifactMetadata createLegacyMetadata( Artifact artifact )