mirror of https://github.com/apache/maven.git
Resolving: MNG-876. Versions are incremented correctly again.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@289348 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8efd4bce77
commit
5038a4d249
|
@ -30,7 +30,9 @@ public final class ArtifactUtils
|
|||
|
||||
public static boolean isSnapshot( String version )
|
||||
{
|
||||
return version != null && ( version.toUpperCase().endsWith( "SNAPSHOT" ) || Artifact.VERSION_FILE_PATTERN.matcher( version ).matches() );
|
||||
return version != null
|
||||
&& ( version.toUpperCase().endsWith( "SNAPSHOT" ) || Artifact.VERSION_FILE_PATTERN.matcher( version )
|
||||
.matches() );
|
||||
}
|
||||
|
||||
public static String versionlessKey( Artifact artifact )
|
||||
|
|
|
@ -239,8 +239,7 @@ public class PrepareReleaseMojo
|
|||
}
|
||||
}
|
||||
|
||||
//TODO reinstate.
|
||||
// removeReleasePoms();
|
||||
removeReleasePoms();
|
||||
|
||||
checkInNextSnapshot();
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ public class ProjectVersionResolver
|
|||
{
|
||||
String projectVersion = project.getOriginalModel().getVersion();
|
||||
|
||||
if ( projectVersion.endsWith( "SNAPSHOT" ) )
|
||||
if ( ArtifactUtils.isSnapshot( projectVersion ) )
|
||||
{
|
||||
String projectId = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() );
|
||||
throw new MojoExecutionException( "The project " + projectId + " is a snapshot (" + projectVersion +
|
||||
|
@ -103,17 +103,25 @@ public class ProjectVersionResolver
|
|||
// releaseVersion = 1.0.4
|
||||
// snapshotVersion = 1.0.5-SNAPSHOT
|
||||
|
||||
String staticVersionPart = null;
|
||||
String nextVersionString = null;
|
||||
if ( projectVersion.indexOf( "-" ) > 0 )
|
||||
|
||||
int dashIdx = projectVersion.lastIndexOf( "-" );
|
||||
int dotIdx = projectVersion.lastIndexOf( "." );
|
||||
|
||||
if ( dashIdx > 0 )
|
||||
{
|
||||
nextVersionString = projectVersion.substring( projectVersion.lastIndexOf( "-" ) + 1 );
|
||||
staticVersionPart = projectVersion.substring( 0, dashIdx + 1 );
|
||||
nextVersionString = projectVersion.substring( dashIdx + 1 );
|
||||
}
|
||||
else if ( projectVersion.indexOf( "." ) > 0 )
|
||||
else if ( dotIdx > 0 )
|
||||
{
|
||||
nextVersionString = projectVersion.substring( projectVersion.lastIndexOf( "." ) + 1 );
|
||||
staticVersionPart = projectVersion.substring( 0, dotIdx + 1 );
|
||||
nextVersionString = projectVersion.substring( dotIdx + 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
staticVersionPart = "";
|
||||
nextVersionString = projectVersion;
|
||||
}
|
||||
|
||||
|
@ -121,8 +129,7 @@ public class ProjectVersionResolver
|
|||
{
|
||||
nextVersionString = Integer.toString( Integer.parseInt( nextVersionString ) + 1 );
|
||||
|
||||
projectVersion = projectVersion.substring( 0, projectVersion.lastIndexOf( "-" ) + 1 ) + nextVersionString +
|
||||
SNAPSHOT_CLASSIFIER;
|
||||
projectVersion = staticVersionPart + nextVersionString + SNAPSHOT_CLASSIFIER;
|
||||
}
|
||||
catch ( NumberFormatException e )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue