From 70bec8507116d7540cb04e78eed9d4be990dc778 Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Tue, 11 Oct 2005 04:29:57 +0000 Subject: [PATCH] PR: MNG-1103 Submitted by: John Tolentino Reviewed by: Brett Porter increment "rcX" correctly git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@312807 13f79535-47bb-0310-9956-ffa450edef68 --- .../release/helpers/ProjectVersionResolver.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/helpers/ProjectVersionResolver.java b/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/helpers/ProjectVersionResolver.java index c7d6baf5c3..9929b86383 100644 --- a/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/helpers/ProjectVersionResolver.java +++ b/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/helpers/ProjectVersionResolver.java @@ -20,7 +20,7 @@ import org.apache.maven.artifact.ArtifactUtils; import org.apache.maven.model.Model; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; -import org.codehaus.plexus.components.inputhandler.InputHandler; +import org.codehaus.plexus.components.interactivity.InputHandler; import org.codehaus.plexus.util.StringUtils; import java.io.IOException; @@ -73,7 +73,7 @@ public class ProjectVersionResolver projectVersion = inputVersion; } } - catch ( Exception e ) + catch ( IOException e ) { throw new MojoExecutionException( "Can't read release version from user input.", e ); } @@ -112,13 +112,19 @@ public class ProjectVersionResolver // releaseVersion = 1.0.4 // snapshotVersion = 1.0.5-SNAPSHOT - String staticVersionPart = null; - String nextVersionString = null; + String staticVersionPart; + String nextVersionString; + int rcIdx = projectVersion.toLowerCase().lastIndexOf( "-rc" ); int dashIdx = projectVersion.lastIndexOf( "-" ); int dotIdx = projectVersion.lastIndexOf( "." ); - if ( dashIdx > 0 ) + if ( rcIdx >= dashIdx ) + { + staticVersionPart = projectVersion.substring( 0, rcIdx + 3 ); + nextVersionString = projectVersion.substring( rcIdx + 3 ); + } + else if ( dashIdx > 0 ) { staticVersionPart = projectVersion.substring( 0, dashIdx + 1 ); nextVersionString = projectVersion.substring( dashIdx + 1 );