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 03c1064225..5168db0b35 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 @@ -32,11 +32,14 @@ public class LatestArtifactTransformation if ( Artifact.LATEST_VERSION.equals( artifact.getVersion() ) ) { String version = resolveVersion( artifact, localRepository, remoteRepositories ); - if ( version != null && !version.equals( artifact.getVersion() ) ) + if ( Artifact.LATEST_VERSION.equals( version ) ) { - artifact.setBaseVersion( version ); - artifact.updateVersion( version, localRepository ); + throw new ArtifactMetadataRetrievalException( + "Unable to determine the latest version for artifact " + artifact ); } + + artifact.setBaseVersion( version ); + artifact.updateVersion( version, localRepository ); } } 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 b852c674c7..96ce214a97 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 @@ -34,20 +34,21 @@ import java.util.List; public class ReleaseArtifactTransformation extends AbstractVersionTransformation { - public static final String RELEASE_VERSION = "RELEASE"; - public void transformForResolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository ) throws ArtifactMetadataRetrievalException { - if ( RELEASE_VERSION.equals( artifact.getVersion() ) ) + if ( Artifact.RELEASE_VERSION.equals( artifact.getVersion() ) ) { String version = resolveVersion( artifact, localRepository, remoteRepositories ); - if ( version != null && !version.equals( artifact.getVersion() ) ) + if ( Artifact.RELEASE_VERSION.equals( version ) ) { - artifact.setBaseVersion( version ); - artifact.updateVersion( version, localRepository ); + throw new ArtifactMetadataRetrievalException( + "Unable to determine the release version for artifact " + artifact ); } + + artifact.setBaseVersion( version ); + artifact.updateVersion( version, localRepository ); } } diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/Artifact.java b/maven-artifact/src/main/java/org/apache/maven/artifact/Artifact.java index 2bee63ba1c..d9fa457e94 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/Artifact.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/Artifact.java @@ -53,6 +53,8 @@ public interface Artifact String SCOPE_SYSTEM = "system"; + String RELEASE_VERSION = "RELEASE"; + String getGroupId(); String getArtifactId(); diff --git a/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java b/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java index 9da5bdda98..71694556ac 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java @@ -22,7 +22,6 @@ import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.metadata.ResolutionGroup; import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.transform.ReleaseArtifactTransformation; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.apache.maven.execution.RuntimeInformation; import org.apache.maven.model.Plugin; @@ -91,7 +90,7 @@ public class DefaultPluginVersionManager * @deprecated Make private, use resolveReportPluginVersion(..) or resolvePluginVersion(..) instead. */ public String resolvePluginVersion( String groupId, String artifactId, MavenProject project, Settings settings, - ArtifactRepository localRepository, boolean resolveAsReportPlugin ) + ArtifactRepository localRepository, boolean resolveAsReportPlugin ) throws PluginVersionResolutionException { // first pass...if the plugin is specified in the pom, try to retrieve the version from there. @@ -127,8 +126,7 @@ public class DefaultPluginVersionManager ( !Boolean.FALSE.equals( pluginUpdateOverride ) && shouldCheckForUpdates( groupId, artifactId ) ) ) { updatedVersion = resolveMetaVersion( groupId, artifactId, project.getPluginArtifactRepositories(), - localRepository, - ReleaseArtifactTransformation.RELEASE_VERSION ); + localRepository, Artifact.RELEASE_VERSION ); if ( StringUtils.isNotEmpty( updatedVersion ) && !updatedVersion.equals( version ) ) { @@ -188,7 +186,7 @@ public class DefaultPluginVersionManager { // 1. resolve the version to be used version = resolveMetaVersion( groupId, artifactId, project.getPluginArtifactRepositories(), localRepository, - ReleaseArtifactTransformation.RELEASE_VERSION ); + Artifact.RELEASE_VERSION ); if ( version != null ) { diff --git a/maven-plugins/maven-assembly-plugin/pom.xml b/maven-plugins/maven-assembly-plugin/pom.xml index 1361559e78..80e8dfffb1 100755 --- a/maven-plugins/maven-assembly-plugin/pom.xml +++ b/maven-plugins/maven-assembly-plugin/pom.xml @@ -25,7 +25,6 @@ org.codehaus.modello modello-maven-plugin - RELEASE @@ -58,4 +57,4 @@ 2.0-beta-1 - \ No newline at end of file +