Skip to content

Commit

Permalink
Gradle wrapper not created on windows
Browse files Browse the repository at this point in the history
Uses gradle.bat vs gradle on windows.
Changed Error to Warn when gradle not found.

Fixes quarkusio#4745
  • Loading branch information
maxandersen authored and vsevel committed Nov 18, 2019
1 parent 26e2d76 commit 9487a64
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
Expand Down Expand Up @@ -58,6 +59,8 @@
@Mojo(name = "create", requiresProject = false)
public class CreateProjectMojo extends AbstractMojo {

final private static boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("windows");

private static String pluginKey;

public static String getPluginKey() {
Expand Down Expand Up @@ -216,15 +219,16 @@ public void execute() throws MojoExecutionException {

private void createGradleWrapper(File projectDirectory) {
try {
ProcessBuilder pb = new ProcessBuilder("gradle", "wrapper",
String gradleName = IS_WINDOWS ? "gradle.bat" : "gradle";
ProcessBuilder pb = new ProcessBuilder(gradleName, "wrapper",
"--gradle-version=" + MojoUtils.getGradleWrapperVersion()).directory(projectDirectory)
.inheritIO();
Process x = pb.start();

x.waitFor();

if (x.exitValue() != 0) {
getLog().error("Unable to install the Gradle wrapper (./gradlew) in project. See log for details.");
getLog().warn("Unable to install the Gradle wrapper (./gradlew) in project. See log for details.");
}

} catch (InterruptedException | IOException e) {
Expand Down

0 comments on commit 9487a64

Please sign in to comment.