apache / apache/maven-dependency-plugin

[MDEP-785] dependency:go-offline does not download all dependencies

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

Description

**[Wei Lin](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=wlnirvana)** opened **[MDEP-785](https://issues.apache.org/jira/browse/MDEP-785?redirect=false)** and commented

It appears the go-offline goal of the maven dependency plugin downloads only jar but no pom for some of the dependencies, and only pom but no jar for some other dependencies.

## Steps to reproduce

### 1. Resolve the pom in attached tar ball

```
$ docker run -it --rm -v $(greadlink -f demo):/tmp/demo:ro maven:3.8.4-eclipse-temurin-11-alpine bash
bash-5.1# mvn -B -f /tmp/demo/pom.xml dependency:go-offline
```

### 2. Verify some jars and poms are missing

```
bash-5.1# ls ~/.m2/repository/org/apache/maven/maven-core/2.0.6/
_remote.repositories maven-core-2.0.6.jar maven-core-2.0.6.jar.sha1
```

```
bash-5.1# ls ~/.m2/repository/org/apache/maven/maven-profile/2.0.6/
_remote.repositories maven-profile-2.0.6.pom maven-profile-2.0.6.pom.sha1
```

### 3. maven test requires more files to be downloaded

```
bash-5.1# mvn test [0/1962]
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< org.example:demo >--------------------------
[INFO] Building demo 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ demo ---
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-core/2.0.6/maven-core-2.0.6.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-core/2.0.6/maven-core-2.0.6.pom (6.7 kB at 3.5 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-parameter-documenter/2.0.6/maven-plugin-parameter-documenter-2.0.6.pom
........
```

### 4. Verify the missing files are downloaded

```
bash-5.1# ls ~/.m2/repository/org/apache/maven/maven-profile/2.0.6/
_remote.repositories maven-profile-2.0.6.jar maven-profile-2.0.6.jar.sha1 maven-profile-2.0.6.pom maven-profile-2.0.6.pom.sha1
bash-5.1# ls ~/.m2/repository/org/apache/maven/maven-core/2.0.6/
_remote.repositories maven-core-2.0.6.jar maven-core-2.0.6.jar.sha1 maven-core-2.0.6.pom maven-core-2.0.6.pom.sha1
```

---

**Attachments:**
- [demo.tar.gz](https://issues.apache.org/jira/secure/attachment/13039236/demo.tar.gz) (_2.37 kB_)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the attached demo pom.xml and run mvn dependency:go-offline in the provided Maven Docker environment. Compare the local repository contents before and after mvn test, focusing on the maven-core and maven-profile 2.0.6 artifacts. Done means dependency:go-offline downloads both the required jars and poms so mvn test needs no additional downloads.

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
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.