Reputation: 857
This question may have an answer already but I couldn't find a satisfying one. I just updated jersey
jars to the latest one. I get jersey
dependencies form the Parent project
which also contains another project as a dependency which uses the lower version of jersey
. I am not updating the jersey
jars in this project. After updating the jars I see two versions of jersey client
one of the them is the latest and the other one is from the project which uses the lower version.Scope is compile. My app is running fine but on the lib folder I see two version of jersey client 1.17 and 2.25.1. Will this cause any issue or Maven will always use the 2.25.1?
Thanks
Upvotes: 1
Views: 105
Reputation: 3381
Maven will always take the dependency which is the nearest to the root of your dependency tree. If two different versions are on the same level, the first one which is declared will be taken. Lets take the following example:
pom.xml
|--A:1.0
|--B:1.0
| |--A:2.0
| |--C:1.0
| |--D:2.0
|--C:2.0
|--D:1.0
Here, the libraries A:1.0
, B:1.0
, C:2.0
and D:2.0
are resolved. While the versions of A
, B
and C
are taken because being nearest to the root, the version of D
is taken because it was declared first.
Upvotes: 3