apache / apache/maven

[MNG-7091] Exclusions in test scope seem to affect compile scope

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

Description

**[Michel Schudel](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=schudel)** opened **[MNG-7091](https://issues.apache.org/jira/browse/MNG-7091?redirect=false)** and commented

It seems that dependency exclusions in the pom of a third-party library affect the dependencies of the application that uses that library, even when that third-party library is in test scope.

I've created a project at https://github.com/MichelSchudel/example-project that reproduces the problem. Below is the information from the readme.md that you can use to reproduce the issue.

 

This project showcases weird dependency behaviour as far as exclusions go.

 

There are two dependencies in this project:
* axual-platform-test-core (test scope)

* nimbus-jose-jwt

 

There is no additional source code, because we don't need it to showcase the issue.

 

When we comment out the `axual-platform-test-core` dependency, we get a dependency tree with three libs:
* nimbus-jose-jwt

* json-smart (dep of nimbus)

* accessors-smart (dep of nimbus)

 

When we undo the commen-out of "axual-platform-test-core" dependency, we get a dependency tree where the "json-smart" and "accessors-smart" deps have _dissappeared_ from the Nimbus tree and are only dependencies of the "axual-platform-test-core".

 

Looking at the pom of "axual-platform-test-core", it excludes "accessors-smart" from its "json-smart" dependency and replaces it with another version:
\
\net.minidev\
\json-smart\
\2.2.1\
\compile\
\
\
\net.minidev\
\accessors-smart\
\
\
\
\
\net.minidev\
\accessors-smart\
\1.1\
\compile\
 

The real issue here is: **why does this have an impact on the compile scope dependency tree of my application?** Since I'm only using `axual-platform-test-core` in _test_ scope, exclusions should have no impact on the _compile scope_, right?

---

**Affects:** 3.6.3

1 votes, 2 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.