Maven
  1. Maven
  2. MNG-4004

Artifact not found when searching on multiple repositories

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Incomplete
    • Affects Version/s: 2.0.9
    • Fix Version/s: None
    • Labels:
      None
    • Complexity:
      Intermediate
    • Number of attachments :
      0

      Description

      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).

        Activity

        Hide
        Brett Porter added a comment -

        I think I see how that could happen since the repository does get set if the artifact is "found".

        Can you be more specific about how the repositories are defined in settings.xml to be sure?

        Show
        Brett Porter added a comment - I think I see how that could happen since the repository does get set if the artifact is "found". Can you be more specific about how the repositories are defined in settings.xml to be sure?
        Brett Porter made changes -
        Field Original Value New Value
        Fix Version/s 2.0.x [ 13141 ]
        Hide
        Johan Vogelzang added a comment -

        I can confirm this issue.
        It shows up when your dependency is declared with a version range. If you fixate your version to <version>1.8</version> and do not use a version range, Maven will search in other repositories as well. If suitable for your situation it could be a workaround.

        Regards,
        Johan

        Show
        Johan Vogelzang added a comment - I can confirm this issue. It shows up when your dependency is declared with a version range. If you fixate your version to <version>1.8</version> and do not use a version range, Maven will search in other repositories as well. If suitable for your situation it could be a workaround. Regards, Johan
        Brett Porter made changes -
        Fix Version/s Issues to be reviewed for 3.x [ 13145 ]
        Fix Version/s 2.2.x (to be reviewed) [ 13141 ]
        Show
        Jason van Zyl added a comment - Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014
        Hide
        Jason van Zyl added a comment -

        Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.

        Show
        Jason van Zyl added a comment - Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.
        Jason van Zyl made changes -
        Resolution Incomplete [ 4 ]
        Status Open [ 1 ] Closed [ 6 ]
        Paul Benedict made changes -
        Fix Version/s Issues to be reviewed for 3.x [ 13145 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            ol
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: