From 341199573600af52783ee3932fd2764bb4160e86 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Fri, 20 Jun 2014 13:28:46 +0100 Subject: [PATCH] Revert BootRunTask changes since they don't add anything (Was an attempt to get Cygwin to recognise the interrupt, but it seems to be doomed so not worth having the extra code in there really.) --- .../boot/gradle/run/BootRunTask.java | 37 +------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/run/BootRunTask.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/run/BootRunTask.java index 01f451d24e..5c2c216eb4 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/run/BootRunTask.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/run/BootRunTask.java @@ -17,7 +17,6 @@ package org.springframework.boot.gradle.run; import java.io.File; -import java.lang.reflect.Field; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; @@ -26,11 +25,7 @@ import java.util.Set; import org.gradle.api.internal.file.collections.SimpleFileCollection; import org.gradle.api.tasks.JavaExec; import org.gradle.api.tasks.SourceSet; -import org.gradle.process.ExecResult; -import org.gradle.process.internal.DefaultJavaExecAction; -import org.gradle.process.internal.ExecHandle; import org.springframework.boot.loader.tools.FileUtils; -import org.springframework.util.ReflectionUtils; /** * Extension of the standard 'run' task with additional Spring Boot features. @@ -58,37 +53,7 @@ public class BootRunTask extends JavaExec { FileUtils.removeDuplicatesFromOutputDirectory(outputDir, directory); } } - try { - executeReflectively(); - } catch (Exception e) { - getLogger().info("Cannot execute action reflectively"); - super.exec(); - } - } - - private ExecResult executeReflectively() throws Exception { - Field builder = ReflectionUtils.findField(JavaExec.class, "javaExecHandleBuilder"); - builder.setAccessible(true); - DefaultJavaExecAction action = (DefaultJavaExecAction) builder.get(this); - setMain(getMain()); - final ExecHandle execHandle = action.build(); - try { - Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { - - @Override - public void run() { - getLogger().info("Aborting java sub-process"); - execHandle.abort(); - } - })); - } catch (Exception e) { - getLogger().warn("Could not attach shutdown hook (child process may be orphaned)"); - } - ExecResult execResult = execHandle.start().waitForFinish(); - if (!isIgnoreExitValue()) { - execResult.assertNormalExitValue(); - } - return execResult; + super.exec(); } }