public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment,
List<MavenProject> reactorProjects )
throws ReleaseExecutionException
{
ReleaseResult result = new ReleaseResult();
resourceBundle = getResourceBundle( releaseEnvironment.getLocale() );
MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects );
if ( releaseDescriptor.isAutoVersionSubmodules() && ArtifactUtils.isSnapshot( rootProject.getVersion() ) )
{
// get the root project
MavenProject project = rootProject;
String projectId = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() );
String nextVersion = resolveNextVersion( project, projectId, releaseDescriptor, result );
if ( convertToSnapshot )
{
if ( releaseDescriptor.isBranchCreation() && convertToBranch )
{
releaseDescriptor.mapReleaseVersion( projectId, nextVersion );
}
else
{
releaseDescriptor.mapDevelopmentVersion( projectId, nextVersion );
}
}
else
{
releaseDescriptor.mapReleaseVersion( projectId, nextVersion );
}
for ( MavenProject subProject : reactorProjects )
{
String subProjectId =
ArtifactUtils.versionlessKey( subProject.getGroupId(), subProject.getArtifactId() );
if ( convertToSnapshot )
{
String v;
if ( ArtifactUtils.isSnapshot( subProject.getVersion() ) )
{
v = nextVersion;
}
else
{
v = subProject.getVersion();
}
if ( releaseDescriptor.isBranchCreation() && convertToBranch )
{
releaseDescriptor.mapReleaseVersion( subProjectId, v );
}
else
{
releaseDescriptor.mapDevelopmentVersion( subProjectId, v );
}
}
else
{
releaseDescriptor.mapReleaseVersion( subProjectId, nextVersion );
}
}
}
else
{
for ( MavenProject project : reactorProjects )
{
String projectId = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() );
String nextVersion = resolveNextVersion( project, projectId, releaseDescriptor, result );
if ( convertToSnapshot )
{
if ( releaseDescriptor.isBranchCreation() && convertToBranch )
{
releaseDescriptor.mapReleaseVersion( projectId, nextVersion );
}
else
{
releaseDescriptor.mapDevelopmentVersion( projectId, nextVersion );
}
}
else
{
releaseDescriptor.mapReleaseVersion( projectId, nextVersion );
}
}
}
result.setResultCode( ReleaseResult.SUCCESS );
return result;
}