We have a project P that depends on a dependency D1.
This dependency D1 has a dependency on D2 with a version range. Let's say [1.7,)
In our company, we have 2 enterprise repositories :
central : central repository that contains all dependencies that can be used by our development teams.
poc : repository that contains dependencies which are being validated by our experts.
In the settings.xml, the central repository is defined before the poc repository
The D2 artifact is present in both repositories, but with different versions:
- D2 version 1.2 is in our poc repository
- D2 version 1.5, 1.7 and 1.8 are in our central repository
When Maven tries to resolve dependencies, it tries to find the best version of the D2 dependency.
So it does the intersection of [1.2, 1.5, 1.7, 1.8] and [1.7,)
The result is 1.8 (available in our central repository).
The problem is that Maven does not find the version 1.8 of D2 because it only searches for it in the poc repository.
We don't know why, but we think that it's because the version 1.2 is in the poc repository, so it also tries to find the version 1.8 in the poc repository.
We found 2 workarounds:
- If we remove the version 1.2 from the poc repository, maven searches for version 1.8 in the central repository (so it works fine).
- If we add the version 1.8 to the poc repository, maven searches for version 1.8 in the poc repository (so it works fine).