apache / apache/maven-dependency-plugin
[MDEP-667] dependency:sources skips *-test-sources.jar by default
- Dominant language
- Java
- Stars
- 175
- Forks
- 196
- Avg merge
- 19h 30m
- Merged PRs (30d)
- 5
Description
**[Jesse Glick](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=jglick@netbeans.org)** opened **[MDEP-667](https://issues.apache.org/jira/browse/MDEP-667?redirect=false)** and commented
Save the following to `/tmp/bug/Dockerfile`:
```none
FROM maven:3.6.3-jdk-8
RUN git clone -b support-core-2.65 https://github.com/jenkinsci/support-core-plugin /src
WORKDIR /src
RUN git checkout HEAD^
RUN mvn -B validate
RUN mvn dependency:build-classpath | tee /classpath
RUN ls -lR ~/.m2/repository/org/jenkins-ci/plugins/workflow/workflow-support | tee /before
RUN mvn dependency:sources
RUN ls -lR ~/.m2/repository/org/jenkins-ci/plugins/workflow/workflow-support | tee /after
RUN diff /before /after | tee /diff
RUN mvn dependency:sources -Dclassifier=test-sources -DincludeArtifactIds=workflow-support
RUN ls -lR ~/.m2/repository/org/jenkins-ci/plugins/workflow/workflow-support | tee /workaround
RUN diff /after /workaround | tee /diff-workaround
```
Now `docker build /tmp/bug` and you will see the problem: sources for [this dependency](https://github.com/jenkinsci/support-core-plugin/blob/086d28109a56e3464f7a46036ba35827e03d33b3/pom.xml#L171-L176) are omitted. The `dependency:sources` downloads sources for the main artifact:
```none
> -rw-r--r-- 1 root root 91116 Jan 3 15:47 workflow-support-3.3-sources.jar
```
after printing
```none
[INFO] The following files have been resolved:
...
[INFO] org.jenkins-ci.plugins.workflow:workflow-support:jar:sources:3.3
...
[INFO] The following files have NOT been resolved:
...
[INFO] org.jenkins-ci.plugins.workflow:workflow-support:jar:3.3:test
...
[INFO] org.jenkins-ci.plugins.workflow:workflow-support:jar:tests:3.3:test
```
but only the workaround command suffices to get sources for the test JAR:
```none
> -rw-r--r-- 1 root root 33273 Jan 3 15:51 workflow-support-3.3-test-sources.jar
```
after printing
```none
[INFO] The following files have been resolved:
[INFO] org.jenkins-ci.plugins.workflow:workflow-support:jar:test-sources:3.3
[INFO]
[INFO] The following files have NOT been resolved:
[INFO] org.jenkins-ci.plugins.workflow:workflow-support:jar:3.3:test
[INFO] org.jenkins-ci.plugins.workflow:workflow-support:jar:tests:3.3:test
```
---
**Affects:** 3.1.1
1 votes, 2 watchers
Contributor guide
No contributing guide indexed for this repository
Research direction
Save the provided reproduction as /tmp/bug/Dockerfile and run docker build /tmp/bug to observe the missing test-sources artifact. Compare the default dependency:sources run with the classifier=test-sources workaround; done means the default command retrieves the dependency's *-test-sources.jar without requiring that workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100