apache / apache/maven

[MNG-4156] Local test scope shouldn't override transitive compile scope

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

Description

**[Stevo Slavić](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=sslavic)** opened **[MNG-4156](https://issues.apache.org/jira/browse/MNG-4156?redirect=false)** and commented

Local test scoped dependencies shouldn't by default override compile scoped transitive dependencies. If one wanted to exclude transitive compile scoped dependency and have it available only in test scope, it would be more natural (for me at least) to require user to specify appropriate excludes section on a dependency that brought transitive dependency with it. In this case (local test scoped vs transitive compile scoped dependency), requiring user to explicitly specify excludes section would more clearly state/document the intention, while currently build tool silently makes a wrong decision (maybe there are times this decision is correct, but IMO it's correct in far less cases than it is wrong).

Attached is example project where current in most cases unwanted behavior can be reproduced.

---

**Affects:** 2.1.0

**Attachments:**
- [example.zip](https://issues.apache.org/jira/secure/attachment/12712904/example.zip) (_9.34 kB_)

**Issue Links:**
- [MNG-6453](https://issues.apache.org/jira/browse/MNG-6453) Local test scope shouldn't override transitive compile scope
(_**"is duplicated by"**_)
- [MNG-6058](https://issues.apache.org/jira/browse/MNG-6058) Test dependencies should override application dependencies only during testing

- [MRESOLVER-391](https://issues.apache.org/jira/browse/MRESOLVER-391) Scope mediation improvements

- [MNG-4789](https://issues.apache.org/jira/browse/MNG-4789) [regression] Difference in compile scope dependency resolution

- [MNG-787](https://issues.apache.org/jira/browse/MNG-787) Dependency suggestion in current project should take precedence over transitive dependencies by default

- [MNG-6453](https://issues.apache.org/jira/browse/MNG-6453) Local test scope shouldn't override transitive compile scope
(_**"is superceded by"**_)

12 votes, 16 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.