Skip to content

Commit ec7d638

Browse files
committed
Update RunMojo to fail when forked JVM returned non-zero exit code
Closes gh-6172
1 parent 159ef8f commit ec7d638

File tree

1 file changed

+5
-1
lines changed
  • spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven

1 file changed

+5
-1
lines changed

spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ public class RunMojo extends AbstractRunMojo {
4141
@Override
4242
protected void runWithForkedJvm(List<String> args) throws MojoExecutionException {
4343
try {
44-
new RunProcess(new JavaExecutable().toString()).run(true,
44+
int exitCode = new RunProcess(new JavaExecutable().toString()).run(true,
4545
args.toArray(new String[args.size()]));
46+
if (exitCode != 0) {
47+
throw new MojoExecutionException(
48+
"Application finished with non-zero exit code: " + exitCode);
49+
}
4650
}
4751
catch (Exception ex) {
4852
throw new MojoExecutionException("Could not exec java", ex);

0 commit comments

Comments
 (0)