diff --git a/src/it/hotfix-finish-it-3/child1/pom.xml b/src/it/hotfix-finish-it-3/child1/pom.xml
new file mode 100644
index 00000000..6062963d
--- /dev/null
+++ b/src/it/hotfix-finish-it-3/child1/pom.xml
@@ -0,0 +1,12 @@
+
+ 4.0.0
+
+
+ com.amashchenko.maven.plugin
+ gitflow-maven-test
+ 1.0
+
+
+ gitflow-maven-test-child1
+ pom
+
diff --git a/src/it/hotfix-finish-it-3/child2/pom.xml b/src/it/hotfix-finish-it-3/child2/pom.xml
new file mode 100644
index 00000000..52bb4f31
--- /dev/null
+++ b/src/it/hotfix-finish-it-3/child2/pom.xml
@@ -0,0 +1,24 @@
+
+ 4.0.0
+
+
+ com.amashchenko.maven.plugin
+ gitflow-maven-test
+ 1.0
+
+
+ gitflow-maven-test-child2
+ pom
+
+
+
+
+ com.amashchenko.maven.plugin
+ gitflow-maven-test-child1
+ ${test.project.version}
+ pom
+ import
+
+
+
+
diff --git a/src/it/hotfix-finish-it-3/expected-production-pom.xml b/src/it/hotfix-finish-it-3/expected-production-pom.xml
new file mode 100644
index 00000000..ab90d24e
--- /dev/null
+++ b/src/it/hotfix-finish-it-3/expected-production-pom.xml
@@ -0,0 +1,16 @@
+
+ 4.0.0
+ com.amashchenko.maven.plugin
+ gitflow-maven-test
+ pom
+ 1.0.1
+
+
+ child1
+ child2
+
+
+
+ 1.0.1
+
+
diff --git a/src/it/hotfix-finish-it-3/gitignorefile b/src/it/hotfix-finish-it-3/gitignorefile
new file mode 100644
index 00000000..bb34bc27
--- /dev/null
+++ b/src/it/hotfix-finish-it-3/gitignorefile
@@ -0,0 +1,7 @@
+build.log
+expected-development-pom.xml
+expected-production-pom.xml
+expected-release-pom.xml
+invoker.properties
+init.bsh
+verify.bsh
diff --git a/src/it/hotfix-finish-it-3/init.bsh b/src/it/hotfix-finish-it-3/init.bsh
new file mode 100644
index 00000000..3ea3cfe6
--- /dev/null
+++ b/src/it/hotfix-finish-it-3/init.bsh
@@ -0,0 +1,42 @@
+import org.codehaus.plexus.util.FileUtils;
+
+try {
+ new File(basedir, "gitignorefile").renameTo(new File(basedir, ".gitignore"));
+
+ Process p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " init");
+ p.waitFor();
+
+ Process p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " config user.email 'a@a.aa'");
+ p.waitFor();
+ Process p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " config user.name 'a'");
+ p.waitFor();
+
+ p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " add .");
+ p.waitFor();
+
+ p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " commit -m init");
+ p.waitFor();
+
+ p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " branch hotfix/1.0.1");
+ p.waitFor();
+
+ p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " checkout hotfix/1.0.1");
+ p.waitFor();
+
+ for (String fileName : new String[] {"pom.xml", "child1/pom.xml", "child2/pom.xml"}) {
+ File pomfile = new File(basedir, fileName);
+ String pomfilestr = FileUtils.fileRead(pomfile, "UTF-8");
+ pomfilestr = pomfilestr.replaceAll("1.0", "1.0.1-SNAPSHOT");
+ FileUtils.fileWrite(basedir + "/" + fileName, "UTF-8", pomfilestr);
+ }
+
+ p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " add .");
+ p.waitFor();
+ p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " commit -m next");
+ p.waitFor();
+
+} catch (Exception e) {
+ e.printStackTrace();
+ return false;
+}
+return true;
diff --git a/src/it/hotfix-finish-it-3/invoker.properties b/src/it/hotfix-finish-it-3/invoker.properties
new file mode 100644
index 00000000..e6dc19fe
--- /dev/null
+++ b/src/it/hotfix-finish-it-3/invoker.properties
@@ -0,0 +1,3 @@
+invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:hotfix-finish -DpushRemote=false -DfetchRemote=false -B -DhotfixVersion=1.0.1 -DuseSnapshotInHotfix=true -DskipMergeDevBranch=true -DversionProperty=test.project.version
+
+invoker.description=Check that versions:set and versions:set-property are applied in the same run. Otherwise, hotfix-finish fails on versions:set-property as pom version is inconsistent (mixed 1.0.1-SNAPSHOT and 1.0.1).
diff --git a/src/it/hotfix-finish-it-3/pom.xml b/src/it/hotfix-finish-it-3/pom.xml
new file mode 100644
index 00000000..4e1b6b10
--- /dev/null
+++ b/src/it/hotfix-finish-it-3/pom.xml
@@ -0,0 +1,16 @@
+
+ 4.0.0
+ com.amashchenko.maven.plugin
+ gitflow-maven-test
+ pom
+ 1.0
+
+
+ child1
+ child2
+
+
+
+ 1.0
+
+
diff --git a/src/it/hotfix-finish-it-3/verify.bsh b/src/it/hotfix-finish-it-3/verify.bsh
new file mode 100644
index 00000000..52260292
--- /dev/null
+++ b/src/it/hotfix-finish-it-3/verify.bsh
@@ -0,0 +1,37 @@
+import org.codehaus.plexus.util.FileUtils;
+
+try {
+
+ File gitTag = new File(basedir, ".git/refs/tags/1.0.1");
+ if (!gitTag.exists()) {
+ System.out.println("hotfix-finish .git/refs/tags/1.0.1 does not exist");
+ return false;
+ }
+ File gitMasterRef = new File(basedir, ".git/refs/heads/master");
+ if (!gitMasterRef.exists()) {
+ System.out.println("hotfix-finish .git/refs/heads/master doesn't exist");
+ return false;
+ }
+
+ p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " checkout master");
+ p.waitFor();
+
+ file = new File(basedir, "pom.xml");
+ expectedFile = new File(basedir, "expected-production-pom.xml");
+
+ actual = FileUtils.fileRead(file, "UTF-8");
+ expected = FileUtils.fileRead(expectedFile, "UTF-8");
+
+ actual = actual.replaceAll("\\r?\\n", "");
+ expected = expected.replaceAll("\\r?\\n", "");
+
+ if (!expected.equals(actual)) {
+ System.out.println("hotfix-finish: " + expected + " actual was:" + actual);
+ return false;
+ }
+
+} catch (Exception e) {
+ e.printStackTrace();
+ return false;
+}
+return true;
diff --git a/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java b/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
index 32803926..cbb8bda5 100644
--- a/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
+++ b/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
@@ -1017,15 +1017,26 @@ protected void mvnSetVersions(final String version) throws MojoFailureException,
executeMvnCommand(TYCHO_VERSIONS_PLUGIN_SET_GOAL, prop, newVersion, "-Dtycho.mode=maven");
} else {
+ boolean runCommand = false;
+ List args = new ArrayList<>();
+ args.add("-DgenerateBackupPoms=false");
+ args.add(newVersion);
if (!skipUpdateVersion) {
- executeMvnCommand(VERSIONS_MAVEN_PLUGIN_SET_GOAL, grp, art, newVersion, "-DgenerateBackupPoms=false");
+ runCommand = true;
+ args.add(VERSIONS_MAVEN_PLUGIN_SET_GOAL);
+ args.add(grp);
+ args.add(art);
}
if (StringUtils.isNotBlank(versionProperty)) {
+ runCommand = true;
getLog().info("Updating property '" + versionProperty + "' to '" + version + "'.");
- executeMvnCommand(VERSIONS_MAVEN_PLUGIN_SET_PROPERTY_GOAL, newVersion, "-Dproperty=" + versionProperty,
- "-DgenerateBackupPoms=false");
+ args.add(VERSIONS_MAVEN_PLUGIN_SET_PROPERTY_GOAL);
+ args.add("-Dproperty=" + versionProperty);
+ }
+ if (runCommand) {
+ executeMvnCommand(args.toArray(new String[0]));
}
}
}