gnodet-bot commented on code in PR #13647:
URL: https://github.com/apache/maven/pull/13647#discussion_r4548689075


##########
impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java:
##########
@@ -113,6 +114,7 @@ public void buildProject(
 
             projectExecutionListener.afterProjectExecutionSuccess(
                     new ProjectExecutionEvent(session, currentProject, 
mojoExecutions));
+            successReported = true;

Review Comment:
   ⚠️ **`successReported` set after the listener call — both callbacks can fire 
for a successful build.**
   
   If `afterProjectExecutionSuccess()` throws (listener bug), `successReported` 
remains `false` and `afterProjectExecutionFailure` fires in the `catch` block — 
even though the project build itself succeeded. Implementors of 
`ProjectExecutionListener` will observe both `afterProjectExecutionSuccess` 
*and* `afterProjectExecutionFailure` for the same project.
   
   Set the flag *before* the call:
   
   ```suggestion
               successReported = true;
               projectExecutionListener.afterProjectExecutionSuccess(
                       new ProjectExecutionEvent(session, currentProject, 
mojoExecutions));
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to