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 Jan 29, 2021
1 parent f99027d commit 4f88300
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
*/
package com.amashchenko.maven.plugin.gitflow;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
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 @@ -191,7 +193,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 4f88300

Please sign in to comment.