apache / apache/maven-dependency-plugin

[MDEP-696] copy:dependencies fails with addParentPom using SNAPSHOT

Open
#1,206 6 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
175
Forks
196
Avg merge
19h 30m
Merged PRs (30d)
5

Description

**[Marc Guillemot](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=mguillemot@yahoo.fr)** opened **[MDEP-696](https://issues.apache.org/jira/browse/MDEP-696?redirect=false)** and commented

`copy:dependencies` fails with `addParentPom=true` when handling snapshots (even if there is no parent): it seems to be a mismatch between timestamped and -SNAPSHOT files.

Here is a simplified example to reproduce the problem:

First project:

```html

4.0.0
poc.bug-dependency-plugin
first-project
0.1-SNAPSHOT


test-snapshots
https://svr-nexus01:9443/repository/test-snapshots/



```

 

"consumer" project:

```html

4.0.0
poc.bug-dependency-plugin
consumer
0.1-SNAPSHOT



poc.bug-dependency-plugin
first-project
0.1-SNAPSHOT






org.apache.maven.plugins
maven-dependency-plugin
3.1.2

true
true







test-snapshots
https://svr-nexus01:9443/repository/test-snapshots/



```

1. Deploy first project

```bash
mvn deploy
```

2. Clean local repository

```bash
rm -rf ~/.m2/repository/poc/bug-dependency-plugin
```

3. Call dependency plugin on consumer project:

```bash
$ mvn -f consumer.pom.xml dependency:copy-dependencies
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< poc.bug-dependency-plugin:consumer >-----------------
[INFO] Building consumer 0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from test-snapshots: https://svr-nexus01:9443/repository/test-snapshots/poc/bug-dependency-plugin/first-project/0.1-SNAPSHOT/first-project-0.1-20200514.130323-1.pom
Downloaded from test-snapshots: https://svr-nexus01:9443/repository/test-snapshots/poc/bug-dependency-plugin/first-project/0.1-SNAPSHOT/first-project-0.1-20200514.130323-1.pom (379 B at 756 B/s)
Downloading from test-snapshots: https://svr-nexus01:9443/repository/test-snapshots/poc/bug-dependency-plugin/first-project/0.1-SNAPSHOT/first-project-0.1-20200514.130323-1.jar
Downloaded from test-snapshots: https://svr-nexus01:9443/repository/test-snapshots/poc/bug-dependency-plugin/first-project/0.1-SNAPSHOT/first-project-0.1-20200514.130323-1.jar (1.5 kB at 9.9 kB/s)
[INFO]
[INFO] --- maven-dependency-plugin:3.1.2:copy-dependencies (default-cli) @ consumer ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.754 s
[INFO] Finished at: 2020-05-14T15:04:28+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.2:copy-dependencies (default-cli) on project consumer: Error resolving project artifact: Could not find artifact poc.bug-dependency-plugin:first-project:pom:0.1-20200514.130323-1 for project poc.bug-dependency-plugin:first-project:jar:0.1-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
```

---

1 votes, 3 watchers

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure by deploying the first project, clearing ~/.m2/repository/poc/bug-dependency-plugin, and running mvn -f consumer.pom.xml dependency:copy-dependencies. Start at the copy-dependencies goal and investigate resolution of the timestamped SNAPSHOT artifact and its POM; done means the command succeeds with addParentPoms enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.