Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new goal added incrementDevelopmentVersionAtFinish to increment the d… #241

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ E.g. `mvn gitflow:release-finish -DpostReleaseGoals=deploy` will run `mvn deploy

The `gitflow:hotfix-finish` goal has `preHotfixGoals` and `postHotfixGoals` parameters which can be used to run defined Maven goals before and after the hotfix respectively.

The `gitflow:feature-finish -DincrementDevelopmentVersionAtFinish=true` will increment the develop branch version after merging the feature.


# Non-interactive Mode

Maven can be run in non-interactive (batch) mode. By using non-interactive mode goals can be run in continuous integration environment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ public class GitFlowFeatureFinishMojo extends AbstractGitFlowMojo {
private String postFeatureFinishGoals;


/**
* Maven goals to increment the development version after merging a feature.
*
* @since 1.14.1
*/
@Parameter(property = "incrementDevelopmentVersionAtFinish")
private boolean incrementDevelopmentVersionAtFinish = false;


/** {@inheritDoc} */
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
Expand Down Expand Up @@ -173,6 +182,17 @@ public void execute() throws MojoExecutionException, MojoFailureException {
mvnRun(postFeatureFinishGoals);
}

if(incrementDevelopmentVersionAtFinish){
gitCheckout(gitFlowConfig.getDevelopmentBranch());
final String currentVersion = getCurrentProjectVersion();
GitFlowVersionInfo developVersionInfo = new GitFlowVersionInfo(currentVersion);
final String nextSnapshotVersion = developVersionInfo.nextSnapshotVersion();
mvnSetVersions(nextSnapshotVersion);
Map<String, String> properties = new HashMap<String, String>();
properties.put("version", nextSnapshotVersion);
gitCommit(commitMessages.getHotfixFinishMessage(), properties);
}

if (installProject) {
// mvn clean install
mvnCleanInstall();
Expand Down