The order of dependencies registered for an artifact version are significant. Consider this scenario:
-
A depends on B (any version) and C [1.0, 2.0].
-
B depends on C (any version).
-
C versions 1.0, 2.0, and 3.0 exist.
In the version range, the syntax [] indicates inclusive, and () indicates exclusive.
|
When retrieving A, the dependency algorithm evaluates B first. The algorithm finds that the maximum version of B depends on any version of C, so the algorithm looks for the maximum C version and finds C 3.0. Because this chain is satisfied, the algorithm returns to A and evaluates its next dependency "C [1.0, 2.0]". This results in matching C 1.0. The returned artifacts are: A, B, C 1.0, and C 3.0.
Consider if the A dependency is changed to:
-
A depends on C [1.0, 2.0] and B (any version).
-
B depends on C (any version).
-
C versions 1.0, 2.0, and 3.0 exist.
The algorithm will choose C 1.0 first. Then the algorithm evaluates B, determines that its "C (any version)" is satisfiable by the already chosen C 1.0. The returned artifacts are A, B, and C 1.0.