apache / apache/maven-dependency-plugin

[MDEP-738] Can't copy dependency from a 3rd party repository

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

Description

**[Pawel Veselov](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=pveselov)** opened **[MDEP-738](https://issues.apache.org/jira/browse/MDEP-738?redirect=false)** and commented

I can't seem to be able to copy a dependency that I previously downloaded from a 3rd party repository, when referring to it using metaversion.

This doesn't work, unless I refer to the version directly in the :copy invocation:

```
$ # rm -rf ~/.m2/repository/org/openconext/ # clean up
$ mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.2:get \
-DremoteRepositories=excelfore.public::::https://dev-esync.excelfore.com/artifactory/excelfore.public \
-Dartifact=org.openconext:mujina-idp:LATEST:jar
$ mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.2:copy \
-Dartifact=org.openconext:mujina-idp:LATEST:jar -DoutputDirectory=/tmp
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.2:copy (default-cli) on project standalone-pom: Unable to find/resolve artifact.: Failed to read artifact descriptor for org.openconext:mujina-idp:jar:LATEST: Failed to resolve version for org.openconext:mujina-idp:jar:LATEST: Could not find metadata org.openconext:mujina-idp/maven-metadata.xml in local (/home/vps/.m2/repository) -> [Help 1]
```

(this is from a real public repo)

I figure this has something to do with the fact that plugin has no knowledge of the repository ID, and needs it to find the right metadata file. So maybe the plugin should have "repositoryId" property that can be supplied to it so it knows which metadata file to check.

---

**Affects:** 3.1.2

**Attachments:**
- [copy-X.txt](https://issues.apache.org/jira/secure/attachment/13021508/copy-X.txt) (_34.65 kB_)
- [get-X.txt](https://issues.apache.org/jira/secure/attachment/13021507/get-X.txt) (_142.10 kB_)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the documented `get` and `copy` Maven commands with `org.openconext:mujina-idp:LATEST:jar`, then inspect the dependency plugin's `copy` and artifact-resolution entry points. Use the attached `copy-X.txt` and `get-X.txt` logs to compare repository and metadata handling; done means `copy` resolves the previously downloaded third-party dependency by metaversion.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.