You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Delany (Jira)" <ji...@apache.org> on 2023/07/12 08:20:00 UTC

[jira] [Comment Edited] (MRESOLVER-372) Download fails if file is currently in use under windows

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

Delany edited comment on MRESOLVER-372 at 7/12/23 8:19 AM:
-----------------------------------------------------------

Can happen at the end of a large deployAtEnd build (on CI machine)
{code:java}
09:46:47  [INFO] Retrying deployment attempt 3 of 3
...
09:50:10  Caused by: java.nio.file.AccessDeniedException: maven-metadata-xxxx-snapshots.xml.12223878285861141839.tmp -> maven-metadata-xxxx-snapshots.xml
09:50:10      at sun.nio.fs.WindowsException.translateToIOException (WindowsException.java:89)
09:50:10      at sun.nio.fs.WindowsException.rethrowAsIOException (WindowsException.java:103)
09:50:10      at sun.nio.fs.WindowsFileCopy.move (WindowsFileCopy.java:309)
09:50:10      at sun.nio.fs.WindowsFileSystemProvider.move (WindowsFileSystemProvider.java:292)
09:50:10      at java.nio.file.Files.move (Files.java:1422)
09:50:10      at org.eclipse.aether.util.FileUtils$2.move (FileUtils.java:108)
09:50:10      at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask (BasicRepositoryConnector.java:500)
09:50:10      at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run (BasicRepositoryConnector.java:414)
09:50:10      at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get (BasicRepositoryConnector.java:215)
09:50:10      at org.eclipse.aether.internal.impl.DefaultDeployer.upload (DefaultDeployer.java:367)
09:50:10      at org.eclipse.aether.internal.impl.DefaultDeployer.deploy (DefaultDeployer.java:238)
09:50:10      at org.eclipse.aether.internal.impl.DefaultDeployer.deploy (DefaultDeployer.java:201)
09:50:10      at org.eclipse.aether.internal.impl.DefaultRepositorySystem.deploy (DefaultRepositorySystem.java:392)
09:50:10      at org.apache.maven.plugins.deploy.AbstractDeployMojo.deploy (AbstractDeployMojo.java:139)
09:50:10      at org.apache.maven.plugins.deploy.DeployMojo.deployAllAtOnce (DeployMojo.java:251)
09:50:10      at org.apache.maven.plugins.deploy.DeployMojo.execute (DeployMojo.java:218) {code}
Maven 3.9.3

-Daether.syncContext.named.factory=file-lock
-Daether.syncContext.named.nameMapper=file-gav


was (Author: delany):
Can happen at the end of a large deployAtEnd build
{code:java}
09:46:47  [INFO] Retrying deployment attempt 3 of 3
...
09:50:10  Caused by: java.nio.file.AccessDeniedException: maven-metadata-xxxx-snapshots.xml.12223878285861141839.tmp -> maven-metadata-xxxx-snapshots.xml
09:50:10      at sun.nio.fs.WindowsException.translateToIOException (WindowsException.java:89)
09:50:10      at sun.nio.fs.WindowsException.rethrowAsIOException (WindowsException.java:103)
09:50:10      at sun.nio.fs.WindowsFileCopy.move (WindowsFileCopy.java:309)
09:50:10      at sun.nio.fs.WindowsFileSystemProvider.move (WindowsFileSystemProvider.java:292)
09:50:10      at java.nio.file.Files.move (Files.java:1422)
09:50:10      at org.eclipse.aether.util.FileUtils$2.move (FileUtils.java:108)
09:50:10      at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask (BasicRepositoryConnector.java:500)
09:50:10      at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run (BasicRepositoryConnector.java:414)
09:50:10      at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get (BasicRepositoryConnector.java:215)
09:50:10      at org.eclipse.aether.internal.impl.DefaultDeployer.upload (DefaultDeployer.java:367)
09:50:10      at org.eclipse.aether.internal.impl.DefaultDeployer.deploy (DefaultDeployer.java:238)
09:50:10      at org.eclipse.aether.internal.impl.DefaultDeployer.deploy (DefaultDeployer.java:201)
09:50:10      at org.eclipse.aether.internal.impl.DefaultRepositorySystem.deploy (DefaultRepositorySystem.java:392)
09:50:10      at org.apache.maven.plugins.deploy.AbstractDeployMojo.deploy (AbstractDeployMojo.java:139)
09:50:10      at org.apache.maven.plugins.deploy.DeployMojo.deployAllAtOnce (DeployMojo.java:251)
09:50:10      at org.apache.maven.plugins.deploy.DeployMojo.execute (DeployMojo.java:218) {code}
Maven 3.9.3

-Daether.syncContext.named.factory=file-lock
-Daether.syncContext.named.nameMapper=file-gav

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