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 2bd43e3a..20337f10 100644 --- a/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java +++ b/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java @@ -795,7 +795,7 @@ protected void gitCreateBranch(final String newBranchName, final String fromBran * is a string to replace with. * @return Message with replaced properties. */ - private String replaceProperties(String message, Map map) { + protected String replaceProperties(String message, Map map) { if (map != null) { for (Entry entr : map.entrySet()) { message = StringUtils.replace(message, "@{" + entr.getKey() + "}", entr.getValue()); diff --git a/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseFinishMojo.java b/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseFinishMojo.java index a513c1f3..2384c32e 100644 --- a/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseFinishMojo.java +++ b/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseFinishMojo.java @@ -244,16 +244,16 @@ public void execute() throws MojoExecutionException, MojoFailureException { mvnCleanTest(); } - // maven goals before merge - if (StringUtils.isNotBlank(preReleaseGoals)) { - mvnRun(preReleaseGoals); - } - String currentReleaseVersion = getCurrentProjectVersion(); Map messageProperties = new HashMap<>(); messageProperties.put("version", currentReleaseVersion); + // maven goals before merge + if (StringUtils.isNotBlank(preReleaseGoals)) { + mvnRun(replaceProperties(preReleaseGoals, messageProperties)); + } + if (useSnapshotInRelease && ArtifactUtils.isSnapshot(currentReleaseVersion)) { String commitVersion = currentReleaseVersion.replace("-" + Artifact.SNAPSHOT_VERSION, ""); diff --git a/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseMojo.java b/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseMojo.java index a588b7a4..bf64dd98 100644 --- a/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseMojo.java +++ b/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseMojo.java @@ -231,14 +231,14 @@ public void execute() throws MojoExecutionException, MojoFailureException { version = defaultVersion; } + Map messageProperties = new HashMap<>(); + messageProperties.put("version", version); + // maven goals before release if (StringUtils.isNotBlank(preReleaseGoals)) { - mvnRun(preReleaseGoals); + mvnRun(replaceProperties(preReleaseGoals, messageProperties)); } - Map messageProperties = new HashMap<>(); - messageProperties.put("version", version); - // execute if version changed if (!version.equals(currentVersion)) { mvnSetVersions(version);