return suggestedVersion;
}
private String getSuggestedHotfixVersion(MavenProject rootProject, String lastRelease) throws MavenJGitFlowException
{
ReleaseContext ctx = contextProvider.getContext();
String suggestedVersion = "unknown";
String defaultVersion = rootProject.getVersion();
if (StringUtils.isNotBlank(ctx.getDefaultReleaseVersion()))
{
defaultVersion = ctx.getDefaultReleaseVersion();
}
if (StringUtils.isNotBlank(lastRelease) && !ArtifactUtils.isSnapshot(lastRelease))
{
try
{
DefaultVersionInfo defaultInfo = new DefaultVersionInfo(defaultVersion);
DefaultVersionInfo lastReleaseInfo = new DefaultVersionInfo(lastRelease);
String higherVersion = defaultVersion;
if (defaultInfo.isSnapshot())
{
higherVersion = lastRelease;
}
else if (defaultInfo.compareTo(lastReleaseInfo) < 1)
{
higherVersion = lastRelease;
}
final HotfixVersionInfo hotfixInfo = new HotfixVersionInfo(higherVersion);
suggestedVersion = hotfixInfo.getHotfixVersionString();
}
catch (VersionParseException e)
{
//just ignore
}
}
else
{
try
{
final HotfixVersionInfo hotfixInfo = new HotfixVersionInfo(defaultVersion);
suggestedVersion = hotfixInfo.getHotfixVersionString();
}
catch (VersionParseException e)
{
//ignore
}
}
// Fixup project version, if it is a snapshot, in such a case decrement the snapshot version
while (StringUtils.isBlank(suggestedVersion) || ArtifactUtils.isSnapshot(suggestedVersion))
{
HotfixVersionInfo info = null;
try
{
info = new HotfixVersionInfo(defaultVersion);
}
catch (VersionParseException e)
{
if (ctx.isInteractive())
{
try
{
info = new HotfixVersionInfo("2.0");
}