Преглед на файлове

Fix BuildCommand.

This patch fixes two issues:
- On unix like platforms, after the clone of the repos, the maven
wrapper is not executable and the build command fails.
- The goal parameter of executeMavenWrapper was not used as the goal for
the maven InvocationRequest.

Changes:
* make maven wrapper executable before executing
* use the actual goal passed to executeMavenWrapper
HorridoJoho преди 2 години
родител
ревизия
47fd4b5548

+ 6 - 2
src/main/java/com/l2jserver/cli/command/BuildCommand.java

@@ -35,6 +35,7 @@ import picocli.CommandLine.Command;
 /**
  * Build command.
  * @author Zoey76
+ * @author HorridoJoho
  * @version 1.0.0
  */
 @Command(name = "build", aliases = "b")
@@ -65,13 +66,16 @@ public class BuildCommand extends AbstractCommand {
 
 	private final void executeMavenWrapper(String goal, String sourceDir, Properties properties, boolean isWindows)
 	        throws MavenInvocationException {
+		File mavenExecutable = new File("mvnw" + (isWindows ? ".cmd" : ""));
+		mavenExecutable.setExecutable(true);
+		
 		InvocationRequest request = new DefaultInvocationRequest();
 		request.setPomFile(new File(sourceDir + "/pom.xml"));
-		request.setGoals(Collections.singletonList("install"));
+		request.setGoals(Collections.singletonList(goal));
 		request.setProperties(properties);
 		Invoker invoker = new DefaultInvoker();
 		invoker.setMavenHome(new File(sourceDir));
-		invoker.setMavenExecutable(new File("mvnw" + (isWindows ? ".cmd" : "")));
+		invoker.setMavenExecutable(mavenExecutable);
 		invoker.execute(request);
 	}
 }

+ 1 - 0
src/main/java/com/l2jserver/cli/command/CodeCommand.java

@@ -33,6 +33,7 @@ import picocli.CommandLine.Option;
 /**
  * Code command.
  * @author Zoey76
+ * @author HorridoJoho
  * @version 1.0.0
  */
 @Command(name = "code", aliases = "c")

+ 1 - 0
src/main/java/com/l2jserver/cli/command/DeployCommand.java

@@ -36,6 +36,7 @@ import picocli.CommandLine.Command;
 /**
  * Deploy command.
  * @author Zoey76
+ * @author HorridoJoho
  * @version 1.0.0
  */
 @Command(name = "deploy", aliases = "d")