Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-5781

resolution of nested import scoped dependencies causes maven to reach out to external central repo



    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.2.5
    • 4.0.x-candidate


      When a project uses a dependency that has as import scoped dependency, which in turn also has another import scoped dependency (nested imported scoped dependencies), resolution of the last level of dependency makes maven to reach our to the external central repository (https://repo.maven.apache.org/maven2/)

      Steps to reproduce:
      Use the attached global settings file.
      It has an internal repository declared as a replacement to 'central', you can point to one of your own internal repo.(not the local)

      Build the attached file first.pom.xml: 

      mvn -gs global_settings.xml install -f first.pom.xml

      Build the attached file second.pom.xml:

      mvn install -f second.pom.xml

      Then, delete org.aspectj:aspectjtools from local repo (rm ~/.m2/repository/org/aspectj/aspectjtools), we want to download this from our internal central repository alias repository.
      Build the attached file last.pom.xml: 

      mvn -gs global_settings.xml dependency:copy-dependencies -f last.pom.xml

      (copy dependencies because this is a pom project, alternatively change last.pom.xml to a jar project and do mvn -gs global_settings.xml install - same thing)

      You'll see that org.aspectj:aspectjtools is being downloaded from central (https://repo.maven.apache.org/maven2/) effectively rendering hosting our own repositories useless.


        1. first.pom.xml
          0.7 kB
          Ravi Sanwal
        2. global_settings.xml
          1.0 kB
          Ravi Sanwal
        3. last.pom.xml
          0.9 kB
          Ravi Sanwal
        4. second.pom.xml
          0.7 kB
          Ravi Sanwal
        5. MNG-5781-Maven360.txt
          27 kB
          Sylwester Lachiewicz

        Issue Links



              Unassigned Unassigned
              rsanwal Ravi Sanwal
              7 Vote for this issue
              9 Start watching this issue