KunLun
KunLun

Reputation: 3225

Maven same dependency in multiple dependencies

Let's say I have 3 libs, compiled using Maven: A, B and C.

And let's say I have this project:

Dependency C is included in A and B.

After compiling My project, dependency C will be present by 3 times? Or just once?

All of them use same version of C

Upvotes: 0

Views: 297

Answers (3)

krishna T
krishna T

Reputation: 418

you will have only one C because you said its the same version.

Upvotes: 0

Silviu Burcea
Silviu Burcea

Reputation: 5348

Before Java 9, you will have only one version, decided by Maven dependency mediation. Java 9+, if those dependencies are modules, each module can use the dependency they have listed.

Upvotes: 0

J Fabian Meier
J Fabian Meier

Reputation: 35785

Maven manages transitive dependencies in a way that of each artifact, only one version will be used for the project.

If you have different versions, the version is decided by Maven dependency mediation.

Upvotes: 1

Related Questions