// Must get default version from mapped versions, as the project will be the incorrect snapshot
String key = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() );
String releaseVersion = (String) releaseDescriptor.getReleaseVersions().get( key );
if ( releaseVersion == null )
{
throw new ReleaseExecutionException( "Project tag cannot be selected if version is not yet mapped" );
}
String defaultTag;
String scmTagNameFormat = releaseDescriptor.getScmTagNameFormat();
if ( scmTagNameFormat != null )
{
Interpolator interpolator = new StringSearchInterpolator( "@{", "}" );
List<String> possiblePrefixes = java.util.Arrays.asList( "project", "pom" );
Properties values = new Properties();
values.setProperty( "artifactId", project.getArtifactId() );
values.setProperty( "groupId", project.getGroupId() );
values.setProperty( "version", releaseVersion );
interpolator.addValueSource( new PrefixedPropertiesValueSource( possiblePrefixes, values, true ) );
RecursionInterceptor recursionInterceptor = new PrefixAwareRecursionInterceptor( possiblePrefixes );
try
{
defaultTag = interpolator.interpolate( scmTagNameFormat, recursionInterceptor );
}
catch ( InterpolationException e )
{
throw new ReleaseExecutionException(
"Could not interpolate specified tag name format: " + scmTagNameFormat, e );
}
}
else
{
defaultTag = project.getArtifactId() + "-" + releaseVersion;
}
ScmProvider provider = null;
try
{
provider = getScmProvider( releaseDescriptor, releaseEnvironment );
}
catch ( ReleaseScmRepositoryException e )
{
throw new ReleaseExecutionException(
"No scm provider can be found for url: " + releaseDescriptor.getScmSourceUrl(), e );
}
defaultTag = provider.sanitizeTagName( defaultTag );
if ( releaseDescriptor.isInteractive() )
{
try
{
tag =
prompter.prompt( "What is SCM release tag or label for \"" + project.getName() + "\"? ("
+ project.getGroupId() + ":" + project.getArtifactId() + ")", defaultTag );
}
catch ( PrompterException e )
{
throw new ReleaseExecutionException( "Error reading version from input handler: " + e.getMessage(),
e );
}
}
else
{