@@ -138,27 +138,12 @@ public void execute() throws MojoExecutionException, MojoFailureException {
138
138
mvnRun (preFeatureFinishGoals );
139
139
}
140
140
141
- // git checkout develop
142
- gitCheckout (gitFlowConfig .getDevelopmentBranch ());
141
+ final String currentFeatureVersion = getCurrentProjectVersion ();
143
142
144
- if (featureSquash ) {
145
- // git merge --squash feature/...
146
- gitMergeSquash (featureBranchName );
147
- gitCommit (featureBranchName );
148
- } else {
149
- // git merge --no-ff feature/...
150
- gitMergeNoff (featureBranchName , commitMessages .getFeatureFinishDevMergeMessage (), null );
151
- }
152
-
153
- // get current project version from pom
154
- final String currentVersion = getCurrentProjectVersion ();
143
+ final String featName = featureBranchName .replaceFirst (gitFlowConfig .getFeatureBranchPrefix (), "" );
155
144
156
- final String featName = featureBranchName
157
- .replaceFirst (gitFlowConfig .getFeatureBranchPrefix (), "" );
158
-
159
- if (currentVersion .contains ("-" + featName )) {
160
- final String version = currentVersion
161
- .replaceFirst ("-" + featName , "" );
145
+ if (currentFeatureVersion .contains ("-" + featName )) {
146
+ final String version = currentFeatureVersion .replaceFirst ("-" + featName , "" );
162
147
163
148
// mvn versions:set -DnewVersion=... -DgenerateBackupPoms=false
164
149
mvnSetVersions (version );
@@ -171,6 +156,18 @@ public void execute() throws MojoExecutionException, MojoFailureException {
171
156
gitCommit (commitMessages .getFeatureFinishMessage (), properties );
172
157
}
173
158
159
+ // git checkout develop
160
+ gitCheckout (gitFlowConfig .getDevelopmentBranch ());
161
+
162
+ if (featureSquash ) {
163
+ // git merge --squash feature/...
164
+ gitMergeSquash (featureBranchName );
165
+ gitCommit (featureBranchName );
166
+ } else {
167
+ // git merge --no-ff feature/...
168
+ gitMergeNoff (featureBranchName , commitMessages .getFeatureFinishDevMergeMessage (), null );
169
+ }
170
+
174
171
// maven goals after merge
175
172
if (StringUtils .isNotBlank (postFeatureFinishGoals )) {
176
173
mvnRun (postFeatureFinishGoals );
@@ -181,10 +178,24 @@ public void execute() throws MojoExecutionException, MojoFailureException {
181
178
mvnCleanInstall ();
182
179
}
183
180
181
+ if (keepBranch ) {
182
+ gitCheckout (featureBranchName );
183
+
184
+ mvnSetVersions (currentFeatureVersion );
185
+
186
+ Map <String , String > properties = new HashMap <String , String >();
187
+ properties .put ("version" , currentFeatureVersion );
188
+ properties .put ("featureName" , featName );
189
+
190
+ gitCommit (commitMessages .getUpdateFeatureBackMessage (), properties );
191
+ }
192
+
184
193
if (pushRemote ) {
185
194
gitPush (gitFlowConfig .getDevelopmentBranch (), false );
186
195
187
- if (!keepBranch ) {
196
+ if (keepBranch ) {
197
+ gitPush (featureBranchName , false );
198
+ } else {
188
199
gitPushDelete (featureBranchName );
189
200
}
190
201
}
0 commit comments