private LocalRepository repository;
public void execute( ReleaseProjectTask task )
throws TaskExecutionException
{
PerformReleaseProjectTask performTask = (PerformReleaseProjectTask) task;
ReleaseManagerListener listener = performTask.getListener();
ReleaseDescriptor descriptor = performTask.getDescriptor();
descriptor.setUseReleaseProfile( performTask.isUseReleaseProfile() );
descriptor.setPerformGoals( performTask.getGoals() );
descriptor.setCheckoutDirectory( performTask.getBuildDirectory().getAbsolutePath() );
repository = performTask.getLocalRepository();
List reactorProjects;
try
{
if ( !StringUtils.isEmpty( descriptor.getWorkingDirectory() ) )
{
MavenProject mavenProject = getMavenProject( performTask );
reactorProjects = getReactorProjects( descriptor, mavenProject );
}
else
{
//Perform with provided release parameters (CONTINUUM-1541)
descriptor.setCheckoutDirectory( performTask.getBuildDirectory().getAbsolutePath() );
// Workaround bugs in maven-release-manager 2.1 that require a project even though it will ultimately
// not be used. TODO: check if upgrading will fix, and return to being an empty list
// The project is fake and won't exist in this location
MavenProject project = new MavenProject();
project.setFile( new File( descriptor.getCheckoutDirectory(), "pom.xml" ) );
reactorProjects = Collections.singletonList( project );
// reactorProjects = Collections.emptyList();
}
}
catch ( ContinuumReleaseException e )
{
ReleaseResult result = createReleaseResult();
result.appendError( e );
continuumReleaseManager.getReleaseResults().put( performTask.getReleaseId(), result );
performTask.getListener().error( e.getMessage() );
throw new TaskExecutionException( "Failed to build reactor projects.", e );
}
ReleaseResult result = releaseManager.performWithResult( descriptor,
new DefaultReleaseEnvironment().setSettings(
settings ), reactorProjects, listener );
//override to show the actual start time
result.setStartTime( getStartTime() );
if ( result.getResultCode() == ReleaseResult.SUCCESS )
{
continuumReleaseManager.getPreparedReleases().remove( performTask.getReleaseId() );
}
continuumReleaseManager.getReleaseResults().put( performTask.getReleaseId(), result );
}