Fix tag creation. We need to store in release.properties the tag choose by user

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@178310 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Emmanuel Venisse 2005-05-24 22:52:55 +00:00
parent ba2f6ce87a
commit 8eb97c2ac9
1 changed files with 42 additions and 18 deletions

View File

@ -65,6 +65,8 @@ public class PrepareReleaseMojo
private Model model;
private String userTag;
protected void executeTask()
throws MojoExecutionException
{
@ -435,7 +437,7 @@ public class PrepareReleaseMojo
}
}
private String getTagLabel()
private String getDefaultTagLabel()
{
String tag = project.getArtifactId().toUpperCase() + "_" + projectVersion.toUpperCase();
@ -446,6 +448,44 @@ public class PrepareReleaseMojo
return tag;
}
private String getTagLabel()
throws MojoExecutionException
{
if ( userTag == null )
{
userTag = getDefaultTagLabel();
try
{
ScmBean scm = getScm();
if ( scm.getTag() == null )
{
getLog().info( "What tag name should be used? [ " + tag + " ]" );
InputHandler handler = (InputHandler) getContainer().lookup( InputHandler.ROLE );
String inputTag = handler.readLine();
if ( !StringUtils.isEmpty( inputTag ) )
{
userTag = inputTag;
}
}
else
{
userTag = scm.getTag();
}
}
catch ( Exception e )
{
throw new MojoExecutionException( "An error is occurred in the tag process.", e );
}
}
return userTag;
}
/**
* Tag the release in preparation for performing the release.
*
@ -466,23 +506,7 @@ public class PrepareReleaseMojo
{
ScmBean scm = getScm();
scm.setWorkingDirectory( basedir );
if ( scm.getTag() == null )
{
getLog().info( "What tag name should be used? [ " + tag + " ]" );
InputHandler handler = (InputHandler) getContainer().lookup( InputHandler.ROLE );
String inputTag = handler.readLine();
if ( !StringUtils.isEmpty( inputTag ) )
{
tag = inputTag;
}
scm.setTag( tag );
}
scm.setTag( tag );
getLog().info( "Tagging release with the label " + tag + "." );