[MNG-6224] Dependency version from test scope leaks into compile scope
- Dominant language
- Java
- Stars
- 5.3k
- Forks
- 3.1k
- Avg merge
- 20h 42m
- Merged PRs (30d)
- 297
Description
**[Andrei Tomashpolskiy](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=atomashpolskiy)** opened **[MNG-6224](https://issues.apache.org/jira/browse/MNG-6224?redirect=false)** and commented
Despite test scope being non-transitive [1] it's still used to resolve versions of compile dependencies. This might be causing issues in IDEs that rely on the Dependency plugin to assemble the application's classpath.
E.g. for the following project configuration **javax.servlet-api** version is resolved to **3.0.1** (using nearest-first strategy to resolve conflicts):
```
project1
|-- project2:compile
|..|-- jetty-server:compile
|....|-- javax.servlet-api:3.1.0:compile
|-- jersey-test-framework-core:test
|..|-- javax.servlet-api:3.0.1:compile
```
My understanding is that it should rather be resolved to 3.1.0, because version 3.0.1 stems from the test scope and should be ignored (AFAIK Maven Shade plugin works in that way).
Please see a runnable code example in https://github.com/atomashpolskiy/maven-transitive-test-dependencies
Thank you!
[1] http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
---
**Affects:** 3.3.9
**Attachments:**
- [mvn_package.txt](https://issues.apache.org/jira/secure/attachment/12865669/mvn_package.txt) (_68.69 kB_)
**Issue Links:**
- [MNG-1378](https://issues.apache.org/jira/browse/MNG-1378) Make dependencies of test-jars transitive
- [MNG-6058](https://issues.apache.org/jira/browse/MNG-6058) Test dependencies should override application dependencies only during testing
- [MNG-4675](https://issues.apache.org/jira/browse/MNG-4675) Compile scoped dependencies replaced by test
- [MNG-7852](https://issues.apache.org/jira/browse/MNG-7852) Use all the versions for dependency resolution rather than "nearest first" or "declared first"
2 votes, 7 watchers
Contributor guide
Assessment
This issue has not been assessed yet.