[
https://issues.apache.org/jira/browse/MNG-7091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17294769#comment-17294769
]
Ilya Serbis commented on MNG-7091:
----------------------------------
The workaround is to put all your test dependencies to the end of the
dependencies list. At least maven will leave your dependencies in compile scope
(although it still downgrades {{accessors-smart}} version)
> Exclusions in test scope seem to affect compile scope
> -----------------------------------------------------
>
> Key: MNG-7091
> URL: https://issues.apache.org/jira/browse/MNG-7091
> Project: Maven
> Issue Type: Bug
> Components: Dependencies
> Affects Versions: 3.6.3
> Reporter: Michel Schudel
> Priority: Major
>
> 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:
> <dependency>
> <groupId>net.minidev</groupId>
> <artifactId>json-smart</artifactId>
> <version>2.2.1</version>
> <scope>compile</scope>
> <exclusions>
> <exclusion>
> <groupId>net.minidev</groupId>
> <artifactId>accessors-smart</artifactId>
> </exclusion>
> </exclusions>
> </dependency>
> <dependency>
> <groupId>net.minidev</groupId>
> <artifactId>accessors-smart</artifactId>
> <version>1.1</version>
> <scope>compile</scope>
>
> 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?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)