diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java index 0a399c03dec..7de65dd5ac8 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java @@ -41,8 +41,12 @@ public class RunMojo extends AbstractRunMojo { @Override protected void runWithForkedJvm(List args) throws MojoExecutionException { try { - new RunProcess(new JavaExecutable().toString()).run(true, + int exitCode = new RunProcess(new JavaExecutable().toString()).run(true, args.toArray(new String[args.size()])); + if (exitCode != 0) { + throw new MojoExecutionException( + "Application finished with non-zero exit code: " + exitCode); + } } catch (Exception ex) { throw new MojoExecutionException("Could not exec java", ex);