try
{
Map<String, String> originalVersions = projectHelper.getOriginalVersions(reactorProjects);
flow = JGitFlow.getOrInit(ctx.getBaseDir(), ctx.getFlowInitContext());
MavenJGitFlowConfiguration config = configManager.getConfiguration(flow.git());
String hotfixLabel = getReleaseLabel(ctx, reactorProjects);
//We need to commit the hotfix versioned poms to develop to avoid a merge conflict
flow.git().checkout().setName(flow.getDevelopBranchName()).call();
updatePomsWithReleaseVersion(ctx, reactorProjects);
flow.git().add().addFilepattern(".").call();
flow.git().commit().setMessage("updating develop with hotfix versions to avoid merge conflicts").call();
flow.git().checkout().setName(flow.getHotfixBranchPrefix() + hotfixLabel);
if(ctx.isPush() || !ctx.isNoTag())
{
ensureOrigin(reactorProjects, flow);
}
getLogger().info("running jgitflow hotfix finish...");
flow.hotfixFinish(hotfixLabel)
.setPush(ctx.isPush())
.setKeepBranch(ctx.isKeepBranch())
.setNoTag(ctx.isNoTag())
.setMessage(ReleaseUtil.interpolate(ctx.getTagMessage(), rootProject.getModel()))
.call();
//make sure we're on develop
flow.git().checkout().setName(flow.getDevelopBranchName()).call();
updatePomsWithPreviousVersions(ctx, reactorProjects, config);
commitAllChanges(flow.git(), "updating poms for development");
config.setLastReleaseVersions(originalVersions);
configManager.saveConfiguration(config,flow.git());
}
catch (JGitFlowException e)
{
throw new JGitFlowReleaseException("Error releasing: " + e.getMessage(), e);