apache / apache/maven

[MNG-7773] Exclusion inside a transitive dependency overrides global visibility of excluded dependency

Open
#9,215 2 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

**[Max Schaefer](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=JIRAUSER300061)** opened **[MNG-7773](https://issues.apache.org/jira/browse/MNG-7773?redirect=false)** and commented

The attached example project has basically these maven dependencies:

```java
sample.ProjectX:Project-X:jar
\- sample.ProjectY:Project-Y:jar
   \- sample.ProjectB:Project-B:jar
      \- sample.ProjectC:Project-C:jar
         \- sample.ProjectD:Project-D:jar
\- sample.ProjectA:Project-A:jar
   \- sample.ProjectC:Project-C:jar
```

In Project-X there is class X which uses class D from Project-D

However, in Project-A's pom there is an exclusion of Project-D on dependency of Project-C 

That is causing Project-D to disappear from the build path of Project-X causing the build to fail.

When removing dependency of Project-A from Project-X then the build works fine.

I believe the exclusion in Project-A pom should not cause Project-D to be excluded also from Project-X build path.

The attached project is just to demo the problem that when adding some third-party dependency to my pom some other transitive dependency can inexpertly disappear from my dependencies.

Especially on huge projects with lots of dependencies this can be very tricky to spot.

The disappeared dependency might contain stuff just needed at runtime by the depending third-party (so not my own project).

 

 

 

---

**Affects:** 3.8.8

**Attachments:**
- [dependencyTestWithFailure.zip](https://issues.apache.org/jira/secure/attachment/13057610/dependencyTestWithFailure.zip) (_13.01 kB_)

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.