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,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 );
}
}

View File

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

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

View File

@ -25,7 +25,6 @@
<plugin>
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
<version>RELEASE</version>
<executions>
<execution>
<goals>
@ -58,4 +57,4 @@
<version>2.0-beta-1</version>
</dependency>
</dependencies>
</project>
</project>