ReleaseDescriptor basedirAlignedReleaseDescriptor =
ReleaseUtil.createBasedirAlignedReleaseDescriptor( releaseDescriptor, reactorProjects );
ScmRepository repository;
ScmProvider provider;
try
{
repository =
scmRepositoryConfigurator.getConfiguredRepository( basedirAlignedReleaseDescriptor.getScmSourceUrl(),
releaseDescriptor,
releaseEnvironment.getSettings() );
repository.getProviderRepository().setPushChanges( releaseDescriptor.isPushChanges() );
provider = scmRepositoryConfigurator.getRepositoryProvider( repository );
}
catch ( ScmRepositoryException e )
{
throw new ReleaseScmRepositoryException( e.getMessage(), e.getValidationMessages() );
}
catch ( NoSuchScmProviderException e )
{
throw new ReleaseExecutionException( "Unable to configure SCM repository: " + e.getMessage(), e );
}
TagScmResult result;
try
{
// TODO: want includes/excludes?
ScmFileSet fileSet = new ScmFileSet( new File( basedirAlignedReleaseDescriptor.getWorkingDirectory() ) );
String tagName = releaseDescriptor.getScmReleaseLabel();
ScmTagParameters scmTagParameters =
new ScmTagParameters( releaseDescriptor.getScmCommentPrefix() + "copy for tag " + tagName );
scmTagParameters.setRemoteTagging( releaseDescriptor.isRemoteTagging() );
scmTagParameters.setScmRevision( releaseDescriptor.getScmReleasedPomRevision() );
if ( getLogger().isDebugEnabled() )
{
getLogger().debug(
"ScmTagPhase :: scmTagParameters remotingTag " + releaseDescriptor.isRemoteTagging() );
getLogger().debug(
"ScmTagPhase :: scmTagParameters scmRevision " + releaseDescriptor.getScmReleasedPomRevision() );
getLogger().debug( "ScmTagPhase :: fileSet " + fileSet );
}
result = provider.tag( repository, fileSet, tagName, scmTagParameters );
}
catch ( ScmException e )
{
throw new ReleaseExecutionException( "An error is occurred in the tag process: " + e.getMessage(), e );
}