gnodet opened a new pull request, #13228: URL: https://github.com/apache/maven/pull/13228
## Summary In a parallel build (`-b concurrent -T1C`), `ReactorReader.cleanProjectLocalRepository()` can throw `NoSuchFileException` when cleaning the project-local-repo entries. ## Root Cause `processEvent()` is called concurrently for different projects' `MojoStarted(clean)` events without synchronization on the project-local-repo path. The sequence of operations: 1. Thread A: `Files.isDirectory(artifactPath)` → `true` (directory exists) 2. Thread B: lists and deletes all files in the same directory 3. Thread A: `Files.delete(path)` → `NoSuchFileException` (file already gone) This is not limited to the same project: projects sharing a groupId tree in the project-local-repo can interfere with each other's cleanup. ## Fix Replace `Files.delete()` with `Files.deleteIfExists()` for all deletions in `cleanProjectLocalRepository()`. The goal of the method is to ensure files no longer exist, not to assert they were present — `deleteIfExists` is semantically correct and race-safe. The same replacement is applied to the parent directory cleanup path (which already had a `catch (DirectoryNotEmptyException)` guard, but not a guard for concurrent deletion). ## Test The fix was tested by building the `maven-core` module successfully. The scenario is inherently concurrent and difficult to unit-test deterministically; the fix uses the standard Java NIO idiom for concurrent-safe deletion. --- _Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_ -- 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]
