apache / apache/maven-install-plugin

[MINSTALL-194] Fail to install snapshot artifact when clean phase is used

Open
#311 11 comments 0 reactions 0 assignees View on GitHub
bug priority:minor
Dominant language
Java
Stars
43
Forks
44
Avg merge
1d 23h
Merged PRs (30d)
11

Description

**[Candice Tosi Michelon](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=JIRAUSER302781)** opened **[MINSTALL-194](https://issues.apache.org/jira/browse/MINSTALL-194?redirect=false)** and commented

{**}After ugrading maven from version 3.6.3 to 3.9.4 a few maven projects started failing in the install phase with the error below{**}: 

Failed to install artifact xxxxxx:jar:1.1-SNAPSHOT: xxxxx-1.1-SNAPSHOT.jar.3154215231322123456.tmp -> xxxxx-1.1-SNAPSHOT.jar -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-install-plugin:3.1.1:install (default-install) on project xxxxx: Failed to install artifact xxxxx:jar:1.1-SNAPSHOT: xxxxx-1.1-SNAPSHOT.jar

Caused by: org.apache.maven.plugin.MojoExecutionException:

Caused by: org.eclipse.aether.installation.InstallationException:

Caused by: java.nio.file.AccessDeniedException:

 

**Command used:** mvn clean install

 

**All the projects affected have the following characteristics:**
* Multi-modules
* The clean phase is used at least once
* The pmd check is performed
* A jar snapshot of the module already existis in the maven repository folder (.m2)

This is not a blocker issue because **it is still possible to build the projects and install the snapshots** in the local repository if the follwoing options are used:
* Option 1: Avoid using the clean phase. Use only 'mvn install'.
* Option 2: Use the following mvn commands:
* mvn clean
* mvn install -N
* mvn install -rf \
* Option 3: Use the following commands:
* mvn clean install (the build will fail trying to install the jar of one of the modules in the .m2 folder)
* mvn install -rf \
* Option 4: skip pmd check:
* mvn clean install -Dpmd.skip=true
* Option 5: delete the jar snapshots previously installed in the maven repository folder.

I can't provide a sample project or pom because I was not able to reproduce the issue in a new project. Also, there are other projects with the same characteristcs that does not present the problem, I could not identify any significant difference between them as dependencies and plugins versions, as well as build configuration, are mostly the same.

---

**Affects:** 3.1.1

**Attachments:**
- [image-2023-11-16-08-15-07-597.png](https://issues.apache.org/jira/secure/attachment/13064457/image-2023-11-16-08-15-07-597.png) (_10.78 kB_)
- [StackTrace.txt](https://issues.apache.org/jira/secure/attachment/13063868/StackTrace.txt) (_12.44 kB_)
- [StackTraceDebug.txt](https://issues.apache.org/jira/secure/attachment/13063869/StackTraceDebug.txt) (_15.87 kB_)

**Issue Links:**
- [MRESOLVER-372](https://issues.apache.org/jira/browse/MRESOLVER-372) Sporadic AccessDeniedEx on Windows

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.