PR: MNG-916

ensure RELEASE is not selected as is

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@292172 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-09-28 13:07:53 +00:00
parent eb1c5b5fb2
commit 826f3e2a86
5 changed files with 19 additions and 16 deletions

View File

@ -32,13 +32,16 @@ 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 ) )
{
throw new ArtifactMetadataRetrievalException(
"Unable to determine the latest version for artifact " + artifact );
}
artifact.setBaseVersion( version );
artifact.updateVersion( version, localRepository );
}
}
}
public void transformForInstall( Artifact artifact, ArtifactRepository localRepository )
throws ArtifactMetadataRetrievalException

View File

@ -34,22 +34,23 @@ 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 ) )
{
throw new ArtifactMetadataRetrievalException(
"Unable to determine the release version for artifact " + artifact );
}
artifact.setBaseVersion( version );
artifact.updateVersion( version, localRepository );
}
}
}
public void transformForInstall( Artifact artifact, ArtifactRepository localRepository )
throws ArtifactMetadataRetrievalException

View File

@ -53,6 +53,8 @@ public interface Artifact
String SCOPE_SYSTEM = "system";
String RELEASE_VERSION = "RELEASE";
String getGroupId();
String getArtifactId();

View File

@ -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;
@ -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 )
{

View File

@ -25,7 +25,6 @@
<plugin>
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
<version>RELEASE</version>
<executions>
<execution>
<goals>