gnodet opened a new issue, #352:
URL: https://github.com/apache/maven-clean-plugin/issues/352

   ## Problem
   
   When `-Dmaven.clean.fast=true` is set, `BackgroundCleaner` runs deletion 
inside a Maven session-end listener (`AbstractEventSpy.onEvent`). Maven catches 
exceptions thrown from listeners and downgrades them to a warning:
   
   ```
   [WARNING] Failed to notify spy EventSpyImpl
   ```
   
   This means `failOnError=true` silently has no effect in fast mode: deletion 
failures are logged as warnings but the build still succeeds. This is 
documented in the current Javadoc but is a real user-visible gap.
   
   ## Root cause
   
   A session-end listener is the wrong execution context to fail a build. 
Maven's listener dispatch swallows exceptions — there is no mechanism to 
propagate them as a `MojoExecutionException` from that point.
   
   ## Proposed approaches
   
   Two options were discussed in PR #347:
   
   1. **Check accumulated errors at next module execution**: have 
`CleanMojo.execute()` check `BackgroundCleaner`'s accumulated fatal errors at 
the start of the next module's run and throw `MojoExecutionException` if any 
exist. This keeps the asynchrony but introduces a one-module delay before the 
failure surfaces.
   
   2. **Give up asynchrony when `failOnError=true`**: when `failOnError=true`, 
have `CleanMojo.execute()` wait for that module's deletion to complete 
synchronously before returning, turning fast mode into a synchronous operation 
for that configuration. Simpler semantics, but defeats the performance benefit 
for that config.
   
   Both have real trade-offs. Neither belonged in PR #347.
   
   ## Related
   
   - PR #347 (session-scoped `BackgroundCleaner`, batch retry) — deferred this 
issue
   - `BackgroundCleaner.errorOccurred` Javadoc explains the structural 
limitation


-- 
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