gnodet opened a new pull request, #355: URL: https://github.com/apache/maven-clean-plugin/pull/355
## Problem When `-Dmaven.clean.fast=true` is set, `failOnError=true` (the default) silently had no effect: deletion failures were logged as warnings but the build succeeded. This is the issue described in #352. ## Root cause The deletion ran inside a background executor thread, and errors were only surfaced at session end through `errorOccurred()` → `run()` → `logger.warn(...)`. A session-end listener cannot structurally fail the build (Maven swallows whatever it throws). ## Fix — option 2 from #352 When `failOnError=true`, `BackgroundCleaner.fastDelete()` now runs the file deletion **synchronously in the calling thread** instead of submitting it to the background executor. The atomic directory move (the "fast" part) still happens, so the build thread is unblocked from its own work immediately; only the actual file deletion blocks until done. Any `IOException` from the deletion is thrown immediately and propagated by `CleanMojo` as a `MojoException`. When `failOnError=false`, deletion remains fully asynchronous (existing behaviour): errors are accumulated and logged as warnings at session end. ## Key changes - `BackgroundCleaner.fastDelete()` gains a `failOnError` parameter. - `deleteInBackground()` now returns `IOException` (null = success) instead of `void`, allowing the synchronous path to propagate errors and the async path to route them through `errorOccurred()`. - `Cleaner.fastDelete()` threads `failOnError` through to `BackgroundCleaner`. - `CleanMojo` / `BackgroundCleaner` Javadoc updated: removed all "failOnError has no effect in fast mode" notes. - `CleanerTest.java`: fixed a pre-existing missing `}` / `/**` pair (introduced in a03c4d7) that caused a compilation failure. - `BackgroundCleanerTest`: two new tests verify the new behaviour (`failOnErrorThrowsWhenDeletionFails`, `failOnErrorFalseDoesNotThrowWhenDeletionFails`). Closes #352 -- 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]
