Skip to content

Commit 318c213

Browse files
authored
Merge pull request #4753 from maxandersen/gradlewindows
Gradle wrapper not created on windows
2 parents 52eb0da + 0abfeaf commit 318c213

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.util.Arrays;
1919
import java.util.HashMap;
2020
import java.util.List;
21+
import java.util.Locale;
2122
import java.util.Map;
2223
import java.util.Objects;
2324
import java.util.Set;
@@ -58,6 +59,8 @@
5859
@Mojo(name = "create", requiresProject = false)
5960
public class CreateProjectMojo extends AbstractMojo {
6061

62+
final private static boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("windows");
63+
6164
private static String pluginKey;
6265

6366
public static String getPluginKey() {
@@ -216,15 +219,16 @@ public void execute() throws MojoExecutionException {
216219

217220
private void createGradleWrapper(File projectDirectory) {
218221
try {
219-
ProcessBuilder pb = new ProcessBuilder("gradle", "wrapper",
222+
String gradleName = IS_WINDOWS ? "gradle.bat" : "gradle";
223+
ProcessBuilder pb = new ProcessBuilder(gradleName, "wrapper",
220224
"--gradle-version=" + MojoUtils.getGradleWrapperVersion()).directory(projectDirectory)
221225
.inheritIO();
222226
Process x = pb.start();
223227

224228
x.waitFor();
225229

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

230234
} catch (InterruptedException | IOException e) {

0 commit comments

Comments
 (0)