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
This commit is contained in:
Emmanuel Venisse 2005-05-17 20:28:55 +00:00
parent 7ba418cc31
commit 3fb3205646
1 changed files with 28 additions and 4 deletions

View File

@ -28,7 +28,11 @@
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 @@ private void transformPom()
//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 @@ private void tag()
{
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 )