[ 
https://issues.apache.org/jira/browse/MRESOLVER-372?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17783779#comment-17783779
 ] 

Slawomir Jaranowski commented on MRESOLVER-372:
-----------------------------------------------

Also occurs when multiple process use the same local repository.
Eg in exec-maven-plugin ITs are executed in parallel, and error is:

{noformat}
Caused by: java.nio.file.AccessDeniedException: 
D:\a\exec-maven-plugin\exec-maven-plugin\target\local-repo\org\apache\maven\shared\maven-shared-utils\0.1\maven-shared-utils-0.1.pom.15783817563503912351.tmp
 -> 
D:\a\exec-maven-plugin\exec-maven-plugin\target\local-repo\org\apache\maven\shared\maven-shared-utils\0.1\maven-shared-utils-0.1.pom
    at sun.nio.fs.WindowsException.translateToIOException 
(WindowsException.java:83)
    at sun.nio.fs.WindowsException.rethrowAsIOException 
(WindowsException.java:97)
    at sun.nio.fs.WindowsFileCopy.move (WindowsFileCopy.java:301)
    at sun.nio.fs.WindowsFileSystemProvider.move 
(WindowsFileSystemProvider.java:287)
    at java.nio.file.Files.move (Files.java:1395)
    at org.eclipse.aether.util.FileUtils$2.move (FileUtils.java:108)
    at 
org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask
 (BasicRepositoryConnector.java:500)
    at 
org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run 
(BasicRepositoryConnector.java:414)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get 
(BasicRepositoryConnector.java:260)
{noformat}

do we have re-try option here?

https://github.com/mojohaus/exec-maven-plugin/actions/runs/6603309437/job/18457179181?pr=384


> Download fails if file is currently in use under windows
> --------------------------------------------------------
>
>                 Key: MRESOLVER-372
>                 URL: https://issues.apache.org/jira/browse/MRESOLVER-372
>             Project: Maven Resolver
>          Issue Type: Bug
>            Reporter: Christoph Läubrich
>            Priority: Major
>
> With the new file-locking in maven-resolver there is a problem under windows 
> if the file is currently used by another process (this can for example happen 
> in an IDE ...) and resolver likes to move the file:
>  
> {code:java}
>  Caused by: java.nio.file.AccessDeniedException: 
> xxx-SNAPSHOT.jar.15463549870494779429.tmp -> xxxx-SNAPSHOT.jar
>         at 
> java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89)
>         at 
> java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
>         at java.base/sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:317)
>         at 
> java.base/sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:293)
>         at java.base/java.nio.file.Files.move(Files.java:1432)
>         at org.eclipse.aether.util.FileUtils$2.move(FileUtils.java:108)
>         at 
> org.eclipse.aether.internal.impl.DefaultFileProcessor.copy(DefaultFileProcessor.java:96)
>         at 
> org.eclipse.aether.internal.impl.DefaultFileProcessor.copy(DefaultFileProcessor.java:88)
>         at 
> org.eclipse.aether.internal.impl.DefaultArtifactResolver.getFile(DefaultArtifactResolver.java:490)
>         ... 30 more{code}
>  
> My suggestion would be that resolver simply uses the temp file if it can't be 
> moved to final location and marks it as delete on exit. Even though this is 
> not optimal, it at least ensures the the build does not fail to the cost that 
> next time the file needs to be downloaded again.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to