@Override public void execute(GitFlowConfiguration configuration, Git git, JGitFlowCommand gitFlowCommand) throws JGitFlowExtensionException { try { BranchType branchType = branchHelper.getCurrentBranchType(); ProjectCacheKey cacheKey = null; switch (branchType) { case RELEASE: cacheKey = ProjectCacheKey.RELEASE_BRANCH; break; case HOTFIX: cacheKey = ProjectCacheKey.HOTFIX_BRANCH; break; case DEVELOP: cacheKey = ProjectCacheKey.DEVELOP_BRANCH; break; case MASTER: cacheKey = ProjectCacheKey.MASTER_BRANCH; break; case FEATURE: cacheKey = ProjectCacheKey.FEATURE_BRANCH; break; default: throw new JGitFlowExtensionException( "Unsupported branch type '" + branchType.name() + "' while running " + this.getClass().getSimpleName() + " command"); } ReleaseContext ctx = contextProvider.getContext(); List<MavenProject> branchProjects = branchHelper.getProjectsForCurrentBranch(); projectHelper.checkPomForVersionState(VersionState.RELEASE, branchProjects); if (!ctx.isAllowSnapshots()) { List<String> snapshots = projectHelper.checkForNonReactorSnapshots(cacheKey, branchProjects); if (!snapshots.isEmpty()) { String details = Joiner.on(ls).join(snapshots); throw new UnresolvedSnapshotsException( "Cannot finish a " + branchType.name().toLowerCase() + " due to snapshot dependencies:" + ls + details); } } } catch (Exception e) { throw new JGitFlowExtensionException( "Error verifying version state in poms: " + e.getMessage(), e); } }
@Override public void execute(GitFlowConfiguration configuration, Git git, JGitFlowCommand gitFlowCommand) throws JGitFlowExtensionException { try { JGitFlow flow = jGitFlowProvider.gitFlow(); ReleaseContext ctx = contextProvider.getContext(); String originalBranchName = branchHelper.getCurrentBranchName(); // check out develop and reload the reactor SessionAndProjects sessionAndProjects = checkoutAndGetProjects.run(flow.getDevelopBranchName()); List<MavenProject> developProjects = sessionAndProjects.getProjects(); String developLabel = labelProvider.getNextVersionLabel( VersionType.DEVELOPMENT, ProjectCacheKey.DEVELOP_BRANCH, developProjects); pomUpdater.updatePomsWithNextDevelopmentVersion( ProjectCacheKey.DEVELOP_BRANCH, developProjects); projectHelper.commitAllPoms( flow.git(), developProjects, ctx.getScmCommentPrefix() + "updating poms for " + developLabel + " development" + ctx.getScmCommentSuffix()); flow.git().checkout().setName(originalBranchName).call(); } catch (Exception e) { throw new JGitFlowExtensionException( "Error updating develop poms to next development version", e); } }