Skip to content

Commit

Permalink
Check for mvn.cmd if mvn fails in build-extension
Browse files Browse the repository at this point in the history
  • Loading branch information
LadyCailin committed Jan 10, 2024
1 parent d527112 commit 04bd728
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/com/laytonsmith/core/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -1537,9 +1537,15 @@ public ArgumentParser getArgumentParser() {
@Override
@SuppressWarnings("UseSpecificCatch")
public void execute(ArgumentParser.ArgumentParserResults parsedArgs) throws Exception {
String mvnCommand = "mvn";
try {
new CommandExecutor("git --version").start().waitFor();
new CommandExecutor("mvn --version").start().waitFor();
try {
new CommandExecutor("mvn --version").start().waitFor();
} catch(IOException e) {
new CommandExecutor("mvn.cmd --version").start().waitFor();
mvnCommand = "mvn.cmd";
}
} catch (IOException e) {
System.err.println("Git and Maven are required (and Maven requires the JDK). These three"
+ " components must be already installed to use this tool.");
Expand Down Expand Up @@ -1593,7 +1599,7 @@ public void execute(ArgumentParser.ArgumentParserResults parsedArgs) throws Exce
.setSystemInputsAndOutputs()
.start().waitFor();
System.out.println("Building extension...");
int mvnBuild = new CommandExecutor(new String[]{"mvn", "package", "-DskipTests"})
int mvnBuild = new CommandExecutor(new String[]{mvnCommand, "package", "-DskipTests"})
.setSystemInputsAndOutputs()
.setWorkingDir(checkoutPath)
.start().waitFor();
Expand Down

0 comments on commit 04bd728

Please sign in to comment.