spring-projects/spring-boot · error · MojoExecutionException
Process terminated with exit code: {}
Error message
Process terminated with exit code: {} What it means
Thrown by JavaProcessExecutor.run as a MojoExecutionException when the forked JVM exits with a code that is neither 0 (success) nor 130 (SIGINT). This is the plugin reporting that the application/process it launched (typically via spring-boot:run with fork, or an AOT/process goal) terminated abnormally. The plugin itself is healthy — the child process failed. Exit 130 is intentionally treated as success because Ctrl-C during run should not fail the build.
Source
Thrown at build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/JavaProcessExecutor.java:75
this.runProcessCustomizer = runProcessCustomizer;
}
JavaProcessExecutor withRunProcessCustomizer(Consumer<RunProcess> customizer) {
Consumer<RunProcess> combinedCustomizer = (this.runProcessCustomizer != null)
? this.runProcessCustomizer.andThen(customizer) : customizer;
return new JavaProcessExecutor(this.mavenSession, this.toolchainManager, combinedCustomizer);
}
int run(File workingDirectory, List<String> args, Map<String, String> environmentVariables)
throws MojoExecutionException {
RunProcess runProcess = new RunProcess(workingDirectory, getJavaExecutable());
if (this.runProcessCustomizer != null) {
this.runProcessCustomizer.accept(runProcess);
}
try {
int exitCode = runProcess.run(true, args, environmentVariables);
if (!hasTerminatedSuccessfully(exitCode)) {
throw new MojoExecutionException("Process terminated with exit code: " + exitCode);
}
return exitCode;
}
catch (IOException ex) {
throw new MojoExecutionException("Process execution failed", ex);
}
}
RunProcess runAsync(File workingDirectory, List<String> args, Map<String, String> environmentVariables)
throws MojoExecutionException {
try {
RunProcess runProcess = new RunProcess(workingDirectory, getJavaExecutable());
runProcess.run(false, args, environmentVariables);
return runProcess;
}
catch (IOException ex) {
throw new MojoExecutionException("Process execution failed", ex);
}View on GitHub (pinned to 5b2dbdbb8b)
Solutions
- Scroll up in the build log — the forked process printed its own exception/stack trace immediately before this message; fix that root cause.
- Run with -Dspring-boot.run.fork=false only if you need the failure to surface in-process (not always supported).
- Validate JVM arguments: -Dspring-boot.run.jvmArguments and any -javaagent paths.
- If the exit code is 137, suspect OOMKill/container memory limits and increase -Xmx or container memory.
Example fix
// before — invalid JVM argument mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Xmx512 -Xms256" // -Xmx missing unit // after mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Xmx512m -Xms256m"
Defensive patterns
Strategy: try-catch
Try / catch
// When invoking spring-boot:run programmatically / wrapping the build
try {
// invoke run/process goal
} catch (org.apache.maven.plugin.MojoExecutionException ex) {
String m = ex.getMessage();
if (m != null && m.startsWith("Process terminated with exit code:")) {
int code = Integer.parseInt(m.substring(m.lastIndexOf(':') + 1).trim());
// surface child process logs; do not mask the real failure
}
throw ex;
} Prevention
- Always read the forked process output above the error — the root cause is there, not in this message.
- Validate -javaagent paths and -Dspring-boot.run.jvmArguments before running.
- If exit code is 137, raise container/JVM memory limits.
When it happens
Trigger: spring-boot:run forking a JVM whose application throws an uncaught exception on startup; an AOT processing or test process exiting non-zero; the application's main method calling System.exit(nonzero); JVM failing to start (e.g. bad -Xmx, missing agent) and exiting with a JVM-reported code;OutOfMemoryError killing the JVM with a specific exit code.
Common situations: Application fails to boot (port in use, missing config, bean wiring error); JVM options are invalid (-Dspring-boot.run.jvmArguments); a -javaagent jar is missing or incompatible; native/AOT processor hits an error and exits 1; test process exits non-zero during process-test-aot.
Related errors
- Process execution failed
- Could not build classpath
- Unable to build classpath
- Failed to load layers configuration with name '%s': '%s' not
- Failed to process custom layers configuration {}
AI-assisted analysis of spring-projects/spring-boot@5b2dbdbb8b (2026-08-04).
Data as JSON: /data/errors/91f4ba25dff18a4d.json.
Report an issue: GitHub.