gnodet opened a new issue, #2204:
URL: https://github.com/apache/maven-resolver/issues/2204

   ## Problem
   
   Maven 3.10.0 introduced a regression on Windows where `mvn install` fails 
with `java.nio.file.AccessDeniedException` when an IDE (e.g. IntelliJ IDEA) has 
the target artifact `.jar` open.
   
   Reported upstream: apache/maven#13329
   
   ## Root Cause
   
   Resolver PR #2083 (commit `a7104fab`) replaced the old stream-based file 
copy with `Files.move()` + `ATOMIC_MOVE` in 
`PathProcessorSupport.retryingMove()` to fix the f007 security finding 
(non-atomic Windows publication).
   
   The old code used `classicCopy()\ which opens the target with a truncating 
`FileOutputStream`. On Windows, this succeeds even when another process has the 
file open for reading, because the stream open uses `FILE_SHARE_READ` semantics.
   
   The new code uses `Files.move()` which maps to `MoveFileEx`/`ReplaceFile` on 
Windows. These system calls require exclusive access to the destination — any 
open handle (including a shared read-only handle from an IDE) causes 
`AccessDeniedException`. With only 5 retries at 50 ms each, persistent IDE 
locks are never released.
   
   ## Fix
   
   After exhausting all `WINDOWS_MOVE_ATTEMPTS` with `AccessDeniedException`, 
fall back to `classicCopy()` directly to the target as a last resort. A system 
property controls the fallback.
   
   _Reported and analyzed by Hermès Agent 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]

Reply via email to