apache / apache/maven-dependency-plugin

[MDEP-737] dependency:list sets compile scope deps as test scope

Open
#1,233 2 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

**[Stephanie Wang](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=stephaniewang526)** opened **[MDEP-737](https://issues.apache.org/jira/browse/MDEP-737?redirect=false)** and commented

Observing this in some googleapis client libraries (relates to: https://github.com/googleapis/java-scheduler/pull/366)

In https://github.com/googleapis/java-scheduler repo,

`mvn dependency:tree -Dverbose -Dincludes=commons-codec` outputs:

[INFO] com.google.cloud:google-cloud-scheduler:jar:1.23.8-SNAPSHOT
[INFO] +- com.google.api:gax:jar:1.62.0:compile
[INFO] | \- com.google.auth:google-auth-library-oauth2-http:jar:0.24.0:compile
[INFO] | \- com.google.http-client:google-http-client:jar:1.39.0:compile (version managed from 1.38.1)
[INFO] | \- org.apache.httpcomponents:httpclient:jar:4.5.13:compile
**[INFO] | \- commons-codec:commons-codec:jar:1.15:compile (version managed from 1.11)**
[INFO] \- com.google.cloud:google-cloud-pubsub:jar:1.111.4:test
[INFO] \- (commons-codec:commons-codec:jar:1.15:compile - version managed from 1.11; scope updated from test; omitted for duplicate)

 

`mvn dependency:list -f pom.xml` outputs:

[INFO] commons-codec:commons-codec:jar:1.15:**test**

However, we are expecting:

[INFO] commons-codec:commons-codec:jar:1.15:**compile**

Since this commons-code is both a compile-scope transitive dependency and a test-scope transitive dependency. Why is it automatically resolved to test-scope?

---

1 votes, 3 watchers

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the report with the java-scheduler example using `mvn dependency:tree -Dverbose -Dincludes=commons-codec` and `mvn dependency:list -f pom.xml`; the issue shows compile scope in the tree but test scope in the list. Trace the dependency:list entry point and compare its scope selection with dependency:tree. Done means the listed commons-codec dependency reflects compile scope when both transitive paths exist.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.