-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Description
If a forked spring boot app finishes with exitCode != 0 && exitCode != EXIT_CODE_SIGINT
a MojoExecutionException
is thrown with the message "Application finished with exit code: " + exitCode
.
This Exception is than catched by the surrounding try-catch and used as cause
in a rethrown MojoExecutionException
with the misleading/wrong message "Could not exec java"
.
So the initial thrown Exception is not "silently swallowed" but it is "hidden" as the root cause of the second Exception which exposes a misleading/wrong message.
This happened to me right when starting my spring boot app (had some problem in an ApplicationContextInitializer
which was caused due to the problems described in #16819 - my app starts without problems in a non forked VM or when starting the JAR file), so my first thought was that something is wrong with my environment or java installation causing spring boot`s inability to "exec java" - took me quite some time.
Therefore optimizing the exception handling in this place (RunMojo#runWithForkedJvm(...)
) would be nice (i.e. more specific error message in first place).
P.S.: Sorry for raising another issue but I'm afraid of creating more off-topic follow-up questions as in #16811 ;-)