Skip to content

Commit

Permalink
Merge pull request #25 from jmanpenilla/master
Browse files Browse the repository at this point in the history
use "mvn.cmd" instead of "mvn" command on Windows. fixes #24
  • Loading branch information
Riley Park committed Sep 28, 2020
2 parents d504b27 + f6ac7b7 commit 130e36f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions java8/src/main/java/io/papermc/paperclip/Paperclip.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Locale;
import java.util.jar.JarInputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
Expand Down Expand Up @@ -256,8 +257,10 @@ private static Path extractPom(Path paperJar) throws IOException {
}

private static void mavenInstall(Path paperJar) {
// On Windows we need to use "mvn.cmd" instead of "mvn"
final String mavenCommand = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows") ? "mvn.cmd" : "mvn";
try {
if (new ProcessBuilder("mvn", "-version").start().waitFor() != 0) {
if (new ProcessBuilder(mavenCommand, "-version").start().waitFor() != 0) {
// Error! It's either not on the path, or something went terribly wrong.
System.err.println("Maven must be installed and on your PATH.");
System.exit(1);
Expand All @@ -275,7 +278,7 @@ private static void mavenInstall(Path paperJar) {
System.exit(1);
}

if (new ProcessBuilder("mvn", "install:install-file", "-Dfile=" + paperJar, "-DpomFile=" + pomPath).start().waitFor() != 0) {
if (new ProcessBuilder(mavenCommand, "install:install-file", "-Dfile=" + paperJar, "-DpomFile=" + pomPath).start().waitFor() != 0) {
// Error! Could not install the file.
System.err.println("Could not install the Paper file.");
return;
Expand Down

0 comments on commit 130e36f

Please sign in to comment.