Update RunMojo to fail when forked JVM returned non-zero exit code

Closes gh-6172
This commit is contained in:
Andy Wilkinson 2016-06-16 11:34:15 +01:00
parent 159ef8f189
commit ec7d6381aa

View File

@ -41,8 +41,12 @@ public class RunMojo extends AbstractRunMojo {
@Override
protected void runWithForkedJvm(List<String> 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);