diff --git a/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java b/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java index 6458452d01..e27a89379c 100644 --- a/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java +++ b/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java @@ -142,9 +142,11 @@ public class DevToolsIntegrationTests { if (System.currentTimeMillis() > end) { throw new IllegalStateException(String.format( "server.port file was not written within 30 seconds. " - + "Application output:%n%s", + + "Application output:%n%s%s", FileCopyUtils.copyToString(new FileReader( - this.launchedApplication.getStandardOut())))); + this.launchedApplication.getStandardOut())), + FileCopyUtils.copyToString(new FileReader( + this.launchedApplication.getStandardError())))); } Thread.sleep(100); } diff --git a/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JvmLauncher.java b/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JvmLauncher.java index e897f8ca56..a2e82af2c5 100644 --- a/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JvmLauncher.java +++ b/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JvmLauncher.java @@ -49,10 +49,10 @@ class JvmLauncher implements TestRule { .asList(System.getProperty("java.home") + "/bin/java", "-cp", classpath)); command.addAll(Arrays.asList(args)); File standardOut = new File(this.outputDirectory, name + ".out"); + File standardError = new File(this.outputDirectory, name + ".err"); Process process = new ProcessBuilder(command.toArray(new String[command.size()])) - .redirectError(new File(this.outputDirectory, name + ".err")) - .redirectOutput(standardOut).start(); - return new LaunchedJvm(process, standardOut); + .redirectError(standardError).redirectOutput(standardOut).start(); + return new LaunchedJvm(process, standardOut, standardError); } static class LaunchedJvm { @@ -61,9 +61,12 @@ class JvmLauncher implements TestRule { private final File standardOut; - LaunchedJvm(Process process, File standardOut) { + private final File standardError; + + LaunchedJvm(Process process, File standardOut, File standardError) { this.process = process; this.standardOut = standardOut; + this.standardError = standardError; } Process getProcess() { @@ -74,6 +77,10 @@ class JvmLauncher implements TestRule { return this.standardOut; } + File getStandardError() { + return this.standardError; + } + } } diff --git a/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/LaunchedApplication.java b/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/LaunchedApplication.java index fc754cef9a..c556da91bf 100644 --- a/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/LaunchedApplication.java +++ b/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/LaunchedApplication.java @@ -29,11 +29,15 @@ class LaunchedApplication { private final File standardOut; + private final File standardError; + private final Process[] processes; - LaunchedApplication(File classesDirectory, File standardOut, Process... processes) { + LaunchedApplication(File classesDirectory, File standardOut, File standardError, + Process... processes) { this.classesDirectory = classesDirectory; this.standardOut = standardOut; + this.standardError = standardError; this.processes = processes; } @@ -48,6 +52,10 @@ class LaunchedApplication { return this.standardOut; } + File getStandardError() { + return this.standardError; + } + File getClassesDirectory() { return this.classesDirectory; } diff --git a/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/LocalApplicationLauncher.java b/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/LocalApplicationLauncher.java index 2f8178866f..bb2932888e 100644 --- a/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/LocalApplicationLauncher.java +++ b/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/LocalApplicationLauncher.java @@ -37,7 +37,7 @@ public class LocalApplicationLauncher implements ApplicationLauncher { LaunchedJvm jvm = jvmLauncher.launch("local", createApplicationClassPath(), "com.example.DevToolsTestApplication", "--server.port=0"); return new LaunchedApplication(new File("target/app"), jvm.getStandardOut(), - jvm.getProcess()); + jvm.getStandardError(), jvm.getProcess()); } protected String createApplicationClassPath() throws Exception { diff --git a/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/RemoteApplicationLauncher.java b/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/RemoteApplicationLauncher.java index c6b6094d05..29b8b3b25d 100644 --- a/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/RemoteApplicationLauncher.java +++ b/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/RemoteApplicationLauncher.java @@ -48,8 +48,8 @@ abstract class RemoteApplicationLauncher implements ApplicationLauncher { "--spring.devtools.remote.secret=secret", "http://localhost:12345"); awaitRemoteSpringApplication(remoteSpringApplicationJvm.getStandardOut()); return new LaunchedApplication(new File("target/remote"), - applicationJvm.getStandardOut(), applicationJvm.getProcess(), - remoteSpringApplicationJvm.getProcess()); + applicationJvm.getStandardOut(), applicationJvm.getStandardError(), + applicationJvm.getProcess(), remoteSpringApplicationJvm.getProcess()); } protected abstract String createApplicationClassPath() throws Exception;