protected void transformScm( MavenProject project, Element rootElement, Namespace namespace,
ReleaseDescriptor releaseDescriptor, String projectId, ScmRepository scmRepository,
ReleaseResult result, String commonBasedir )
throws ReleaseExecutionException
{
// If SCM is null in original model, it is inherited, no mods needed
if ( project.getScm() != null )
{
Element scmRoot = rootElement.getChild( "scm", namespace );
if ( scmRoot != null )
{
Scm scm = buildScm( project );
releaseDescriptor.mapOriginalScmInfo( projectId, scm );
try
{
translateScm( project, releaseDescriptor, scmRoot, namespace, scmRepository, result,
commonBasedir );
}
catch ( IOException e )
{
throw new ReleaseExecutionException( e.getMessage(), e );
}
}
else
{
releaseDescriptor.mapOriginalScmInfo( projectId, null );
MavenProject parent = project.getParent();
if ( parent != null )
{
// If the SCM element is not present, only add it if the parent was not mapped (ie, it's external to
// the release process and so has not been modified, so the values will not be correct on the tag),
String parentId = ArtifactUtils.versionlessKey( parent.getGroupId(), parent.getArtifactId() );
if ( !releaseDescriptor.getOriginalScmInfo().containsKey( parentId ) )
{
// we need to add it, since it has changed from the inherited value
scmRoot = new Element( "scm" );
scmRoot.addContent( "\n " );
try
{
if ( translateScm( project, releaseDescriptor, scmRoot, namespace, scmRepository, result,
commonBasedir ) )
{
rootElement.addContent( "\n " ).addContent( scmRoot ).addContent( "\n" );
}
}
catch ( IOException e )
{
throw new ReleaseExecutionException( e.getMessage(), e );
}
}
}
}
}
}
private boolean translateScm( MavenProject project, ReleaseDescriptor releaseDescriptor, Element scmRoot,
Namespace namespace, ScmRepository scmRepository, ReleaseResult relResult,
String commonBasedir )
throws IOException
{
ScmTranslator translator = getScmTranslators().get( scmRepository.getProvider() );
boolean result = false;
if ( translator != null )
{
Scm scm = project.getOriginalModel().getScm();
if ( scm == null )
{
scm = project.getScm();
}
String branchName = releaseDescriptor.getScmReleaseLabel();