Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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