apache / apache/maven

[MNG-6058] Test dependencies should override application dependencies only during testing

Open
#7,682 8 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Christian Schulte](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=schulte77)** opened **[MNG-6058](https://issues.apache.org/jira/browse/MNG-6058?redirect=false)** and commented

The following graph

```
POM
|->a 2.0 compile
|-->b 2.0 compile
|->b 1.0 test
```

will be mediated to

```
POM
|->a 2.0 compile
|->b 1.0 test
```

The test dependency on b will make the transitive application dependency on b disappear. Maven should understand that the application dependency on b in version 2.0 is part of the application classpath and that the test dependency on b in version 1.0 is part of the test classpath only (overriding the application classpath). If someone adds a dependency on a project like that, the test dependency will disappear because the test scope is not transitive so that a "consuming" project gets a different application classpath than the project itself.

---

**Attachments:**
- [MNG-6058.zip](https://issues.apache.org/jira/secure/attachment/12816537/MNG-6058.zip) (_2.09 kB_)

**Issue Links:**
- [MNG-6056](https://issues.apache.org/jira/browse/MNG-6056) Implement Feature Toggle Module to handle Feature Toggles
(_**"is blocked by"**_)
- [MDEP-812](https://issues.apache.org/jira/browse/MDEP-812) Error opening zip file or JAR manifest missing : ${groupId:artifactId:jar}
(_**"causes"**_)
- [MDEP-791](https://issues.apache.org/jira/browse/MDEP-791) Non-test scoped and transitive dependencies in compile scope
(_**"causes"**_)
- [MRESOLVER-391](https://issues.apache.org/jira/browse/MRESOLVER-391) Scope mediation improvements

- [MDEP-791](https://issues.apache.org/jira/browse/MDEP-791) Non-test scoped and transitive dependencies in compile scope

- [MNG-6224](https://issues.apache.org/jira/browse/MNG-6224) Dependency version from test scope leaks into compile scope

- [MNG-7852](https://issues.apache.org/jira/browse/MNG-7852) Use all the versions for dependency resolution rather than "nearest first" or "declared first"

- [MNG-4156](https://issues.apache.org/jira/browse/MNG-4156) Local test scope shouldn't override transitive compile scope

- [MNG-5988](https://issues.apache.org/jira/browse/MNG-5988) Dependency mediation should prioritize transitive dependencies based on scope.
(_**"supercedes"**_)

11 votes, 27 watchers

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.