apache / apache/maven-dependency-plugin

[MDEP-591] Deployment confuses copy-dependencies: Search for timestamped SNAPSHOTs

Open
#1,027 0 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

**[Andreas Sewe](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=sewe)** opened **[MDEP-591](https://issues.apache.org/jira/browse/MDEP-591?redirect=false)** and commented

Tested this with both versions 3.0.2 and 2.10.

I want to use `deploy:deploy` together with `depedency:copy-dependencies` to create a small, self-contained Maven repository containing just my projects and their dependencies.

For projects with release versions this works fine, but it fails for snapshots.

Steps to reproduce using a publicly available project:

```
> git clone https://github.com/apache/maven-resolver.git
> cd maven-resolver
> git checkout f7288bbbd8918e985e70cffd3f8a7950cf88dd50
> mvn -DskipTests -Dcheckstyle.skip -Drat.skip clean # Don't both with unnecessary steps \
deploy -DaltDeploymentRepository=platform::default::file:///tmp/maven-resolver-repository \
dependency:copy-dependencies -DoutputDirectory=/tmp/maven-resolver-repository -Dmdep.useRepositoryLayout=true -Dmdep.addParentPoms=true
```

This fails with the following error message:

```
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.10:copy-dependencies (default-cli) on project maven-resolver-api: Could not find artifact org.apache.maven.resolver:maven-resolver:pom:1.1.1-20171206.115240-1 in apache.snapshots (https://repository.apache.org/snapshots)
```

But `org.apache.maven.resolver:maven-resolver:pom:1.1.1-SNAPSHOT` is part of the same reactor; it is just that `dependency:copy-dependencies` is looking for a timestamped artifact that causes the failure.

FWIW, these problems do not occur if `dependency:copy-dependencies` is invoked in a separate project, i.e., `mvn clean deploy … && mvn dependency:copy-dependencies`.

---

**Affects:** 2.10, 3.0.2

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with the Maven commands and the pinned maven-resolver revision shown in the issue. Compare running deploy and dependency:copy-dependencies in one reactor with running them in separate invocations; done means timestamped SNAPSHOT dependencies resolve from the generated repository without the reported artifact error.

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.