From 3fb3205646e38fad8224c6736a27512c8d3eca2e Mon Sep 17 00:00:00 2001 From: Emmanuel Venisse Date: Tue, 17 May 2005 20:28:55 +0000 Subject: [PATCH] Allow user input for project version and tag name. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@170653 13f79535-47bb-0310-9956-ffa450edef68 --- .../plugin/release/PrepareReleaseMojo.java | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PrepareReleaseMojo.java b/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PrepareReleaseMojo.java index 9581ca6530..aedf3053fb 100644 --- a/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PrepareReleaseMojo.java +++ b/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PrepareReleaseMojo.java @@ -28,7 +28,11 @@ import org.apache.maven.plugin.transformer.VersionTransformer; import org.apache.maven.project.MavenProject; import org.apache.maven.scm.ScmException; import org.apache.maven.scm.ScmFile; +import org.codehaus.plexus.util.StringUtils; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; @@ -67,15 +71,15 @@ public class PrepareReleaseMojo protected void executeTask() throws MojoExecutionException { - checkStatus(); + //checkStatus(); - checkDependencies(); + //checkDependencies(); transformPom(); - checkin(); + //checkin(); - tag(); + //tag(); } private boolean isSnapshot( String version ) @@ -178,6 +182,20 @@ public class PrepareReleaseMojo //Rewrite project version projectVersion = model.getVersion().substring( 0, model.getVersion().length() - SNAPSHOT.length() ); + try + { + getLog().info( "What is the new version? [" + projectVersion + "]" ); + BufferedReader input = new BufferedReader( new InputStreamReader( System.in ) ); + String inputVersion = input.readLine(); + if ( !StringUtils.isEmpty( inputVersion ) ) + { + projectVersion = inputVersion; + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Can't read user input.", e ); + } model.setVersion( projectVersion ); //Rewrite parent version @@ -263,6 +281,12 @@ public class PrepareReleaseMojo { try { + if ( getScm().getTag() == null ) + { + getLog().info( "What is the new tag name?" ); + BufferedReader input = new BufferedReader( new InputStreamReader( System.in ) ); + getScm().setTag( input.readLine() ); + } getScm().tag(); } catch ( Exception e )