VersionInfo nextSnapshotVersionInfo = null;
boolean nextSnapshotVersionIsExplicit = false;
try
{
currentVersionInfo = new DefaultVersionInfo( project.getVersion() );
// The release/branch version defaults to currentVersionInfo (snapshot for branch, and release for tag)
releaseVersionInfo = currentVersionInfo;
// Check if the user specified a release version
if ( releaseDescriptor.getDefaultReleaseVersion() != null )
{
releaseVersionInfo = new DefaultVersionInfo( releaseDescriptor.getDefaultReleaseVersion() );
releaseVersionIsExplicit = true;
}
if ( releaseDescriptor.getReleaseVersions() != null )
{
String releaseVersion = ( String ) releaseDescriptor.getReleaseVersions().get( projectId );
if ( releaseVersion != null )
{
releaseVersionInfo = new DefaultVersionInfo( releaseVersion );
releaseVersionIsExplicit = true;
}
}
// The next snapshot version defaults to the next version after the release version
nextSnapshotVersionInfo = releaseVersionInfo.getNextVersion();
// Check if the user specified a new snapshot version
if ( releaseDescriptor.getDefaultDevelopmentVersion() != null )
{
nextSnapshotVersionInfo = new DefaultVersionInfo( releaseDescriptor.getDefaultDevelopmentVersion() );
nextSnapshotVersionIsExplicit = true;
}
if ( releaseDescriptor.getDevelopmentVersions() != null )
{
String nextDevVersion = ( String ) releaseDescriptor.getDevelopmentVersions().get( projectId );
if ( nextDevVersion != null )
{
nextSnapshotVersionInfo = new DefaultVersionInfo( nextDevVersion );
nextSnapshotVersionIsExplicit = true;
}
}
}
catch ( VersionParseException e )
{
String msg = "Error parsing version, cannot determine next version: " + e.getMessage();
if ( releaseDescriptor.isInteractive() )
{
logWarn( result, msg );
logDebug( result, e.getMessage(), e );
// set defaults for resume in interactive mode
if ( releaseVersionInfo == null )
{
try
{
releaseVersionInfo = new DefaultVersionInfo( "1.0" );
}
catch ( VersionParseException e1 )
{
// if that happens we are in serious trouble!
throw new ReleaseExecutionException( "Version 1.0 could not be parsed!", e1 );