diff --git a/daemon/src/main/java/org/mvndaemon/mvnd/logging/smart/LoggingExecutionListener.java b/daemon/src/main/java/org/mvndaemon/mvnd/logging/smart/LoggingExecutionListener.java index 3fe2a20ac..a3285b199 100644 --- a/daemon/src/main/java/org/mvndaemon/mvnd/logging/smart/LoggingExecutionListener.java +++ b/daemon/src/main/java/org/mvndaemon/mvnd/logging/smart/LoggingExecutionListener.java @@ -23,6 +23,7 @@ import org.apache.maven.execution.ExecutionEvent; import org.apache.maven.execution.ExecutionListener; +import org.apache.maven.execution.MavenExecutionRequest; import org.apache.maven.execution.MavenSession; import org.apache.maven.execution.ProjectExecutionEvent; import org.apache.maven.execution.ProjectExecutionListener; @@ -58,12 +59,23 @@ public void afterProjectExecutionSuccess(ProjectExecutionEvent projectExecutionE @Override public void afterProjectExecutionFailure(ProjectExecutionEvent projectExecutionEvent) { MavenSession session = projectExecutionEvent.getSession(); + boolean halted; + // The ReactorBuildStatus is only available if the SmartBuilder is used ReactorBuildStatus status = (ReactorBuildStatus) session.getRepositorySession().getData().get(ReactorBuildStatus.class); + if (status != null) { + halted = status.isHalted(); + } else { + // assume sensible default + Throwable t = projectExecutionEvent.getCause(); + halted = (t instanceof RuntimeException || !(t instanceof Exception)) + || !MavenExecutionRequest.REACTOR_FAIL_NEVER.equals(session.getReactorFailureBehavior()) + && !MavenExecutionRequest.REACTOR_FAIL_AT_END.equals(session.getReactorFailureBehavior()); + } Throwable cause = projectExecutionEvent.getCause(); buildEventListener.executionFailure( projectExecutionEvent.getProject().getArtifactId(), - status.isHalted(), + halted, cause != null ? cause.toString() : null); }