mirror of https://github.com/apache/maven.git
PR: MNG-297
Make sure that the base version is correctly set to -SNAPSHOT instead of a resolved timestamp when appropriate git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163916 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4493e3cbeb
commit
f86ee59771
|
@ -57,6 +57,7 @@ public class SnapshotTransformation
|
|||
Matcher m = SnapshotArtifactMetadata.VERSION_FILE_PATTERN.matcher( artifact.getBaseVersion() );
|
||||
if ( m.matches() )
|
||||
{
|
||||
// This corrects the base version, but ensure it is not resolved again
|
||||
artifact.setBaseVersion( m.group( 1 ) + "-SNAPSHOT" );
|
||||
}
|
||||
else if ( isSnapshot( artifact ) )
|
||||
|
@ -205,6 +206,11 @@ public class SnapshotTransformation
|
|||
public void transformForInstall( Artifact artifact, ArtifactRepository localRepository )
|
||||
throws ArtifactMetadataRetrievalException
|
||||
{
|
||||
Matcher m = SnapshotArtifactMetadata.VERSION_FILE_PATTERN.matcher( artifact.getBaseVersion() );
|
||||
if ( m.matches() )
|
||||
{
|
||||
artifact.setBaseVersion( m.group( 1 ) + "-SNAPSHOT" );
|
||||
}
|
||||
try
|
||||
{
|
||||
SnapshotArtifactMetadata metadata = SnapshotArtifactMetadata.readFromLocalRepository( artifact,
|
||||
|
@ -228,7 +234,13 @@ public class SnapshotTransformation
|
|||
public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository )
|
||||
throws ArtifactMetadataRetrievalException
|
||||
{
|
||||
if ( isSnapshot( artifact ) )
|
||||
Matcher m = SnapshotArtifactMetadata.VERSION_FILE_PATTERN.matcher( artifact.getBaseVersion() );
|
||||
if ( m.matches() )
|
||||
{
|
||||
// This corrects the base version, but ensure it is not updated again
|
||||
artifact.setBaseVersion( m.group( 1 ) + "-SNAPSHOT" );
|
||||
}
|
||||
else if ( isSnapshot( artifact ) )
|
||||
{
|
||||
SnapshotArtifactMetadata metadata = SnapshotArtifactMetadata.retrieveFromRemoteRepository( artifact,
|
||||
remoteRepository,
|
||||
|
|
|
@ -31,8 +31,6 @@ import org.codehaus.plexus.logging.AbstractLogEnabled;
|
|||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -60,7 +58,9 @@ public class DefaultModelInheritanceAssembler
|
|||
// currentVersion
|
||||
if ( child.getVersion() == null )
|
||||
{
|
||||
child.setVersion( parent.getVersion() );
|
||||
// The parent version may have resolved to something different, so we take what we asked for...
|
||||
// instead of - child.setVersion( parent.getVersion() );
|
||||
child.setVersion( child.getParent().getVersion() );
|
||||
}
|
||||
|
||||
// inceptionYear
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.maven.project.inheritance;
|
|||
import junit.framework.TestCase;
|
||||
import org.apache.maven.model.Build;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Parent;
|
||||
import org.apache.maven.model.Resource;
|
||||
import org.apache.maven.model.Scm;
|
||||
|
||||
|
@ -61,6 +62,12 @@ public class DefaultModelInheritanceAssemblerTest
|
|||
|
||||
Model child = new Model();
|
||||
|
||||
Parent parentElement = new Parent();
|
||||
parentElement.setArtifactId( parent.getArtifactId() );
|
||||
parentElement.setGroupId( parent.getGroupId() );
|
||||
parentElement.setVersion( parent.getVersion() );
|
||||
child.setParent( parentElement );
|
||||
|
||||
child.setPackaging( "plugin" );
|
||||
|
||||
Build childBuild = new Build();
|
||||
|
@ -257,6 +264,8 @@ public class DefaultModelInheritanceAssemblerTest
|
|||
|
||||
model.setArtifactId( artifactId );
|
||||
|
||||
model.setVersion( "1.0" );
|
||||
|
||||
if ( connection != null || developerConnection != null || url != null )
|
||||
{
|
||||
Scm scm = new Scm();
|
||||
|
|
Loading…
Reference in New Issue