Friday, 18 March 2022

Maven: dependency mediation

Dependency mediation is a process to choose the version of an artifact, when multiple versions of the same artifact encountered in the project dependencies. In case of version conflicts, maven choose the nearest definition in the dependency tree.

 

Let me explain with an example.

 


As you see above image, project ‘A’ dependent on the dependencies B, C and D. B, C and D are dependent on the artifact X.

a.   A -> B -> I -> X (1.0)

b.   A -> C -> J -> K -> X (3.0)

c.    A -> D -> X(2.0)

In the above scenario, X(2.0) will be used when building A, because the path from A to X through D is shorter.



Previous                                                 Next                                                 Home

No comments:

Post a Comment