Skip to content

Commit

Permalink
Maven Wrapper mvnw and mvnw.cmd built-in support
Browse files Browse the repository at this point in the history
  • Loading branch information
nhojpatrick committed Sep 9, 2021
1 parent e742b5b commit 9c3aa6e
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.amashchenko.maven.plugin.gitflow;

import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
Expand All @@ -25,6 +26,7 @@
import java.util.TimeZone;
import java.util.regex.Pattern;

import org.apache.commons.lang3.SystemUtils;
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Dependency;
Expand Down Expand Up @@ -205,7 +207,15 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
private void initExecutables() {
if (StringUtils.isBlank(cmdMvn.getExecutable())) {
if (StringUtils.isBlank(mvnExecutable)) {
mvnExecutable = "mvn";
if (SystemUtils.IS_OS_UNIX
&& new File(".", "mvnw").isFile()) {
mvnExecutable = "./mvnw";
} else if (SystemUtils.IS_OS_WINDOWS
&& new File(".", "mvnw.cmd").isFile()) {
mvnExecutable = "mvnw.cmd";
} else {
mvnExecutable = "mvn";
}
}
cmdMvn.setExecutable(mvnExecutable);
}
Expand Down

0 comments on commit 9c3aa6e

Please sign in to comment.