}
}
checkoutDirectory.mkdirs();
CheckOutScmResult scmResult;
try
{
scmResult = provider.checkOut( repository, new ScmFileSet( checkoutDirectory ),
new ScmTag( releaseDescriptor.getScmReleaseLabel() ) );
}
catch ( ScmException e )
{
result.setResultCode( ReleaseResult.ERROR );
logError( result, e.getMessage() );
throw new ReleaseExecutionException( "An error is occurred in the checkout process: " + e.getMessage(), e );
}
String scmRelativePathProjectDirectory = scmResult.getRelativePathProjectDirectory();
if ( StringUtils.isEmpty( scmRelativePathProjectDirectory ) )
{
String basedir;
try
{
basedir = ReleaseUtil.getCommonBasedir( reactorProjects );
}
catch ( IOException e )
{
throw new ReleaseExecutionException( "Exception occurred while calculating common basedir: "
+ e.getMessage(), e );
}
String rootProjectBasedir = rootProject.getBasedir().getAbsolutePath();
try
{
if ( ReleaseUtil.isSymlink( rootProject.getBasedir() ) )
{
rootProjectBasedir = rootProject.getBasedir().getCanonicalPath();
}
}
catch ( IOException e )
{
throw new ReleaseExecutionException( e.getMessage(), e );
}
if ( rootProjectBasedir.length() > basedir.length() )
{
scmRelativePathProjectDirectory = rootProjectBasedir.substring( basedir.length() + 1 );
}
}
releaseDescriptor.setScmRelativePathProjectDirectory( scmRelativePathProjectDirectory );
if ( !scmResult.isSuccess() )
{
result.setResultCode( ReleaseResult.ERROR );
logError( result, scmResult.getProviderMessage() );
throw new ReleaseScmCommandException( "Unable to checkout from SCM", scmResult );
}
result.setResultCode( ReleaseResult.SUCCESS );