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

"Nested imports" doesn't work on Maven 2.0.9

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Incomplete
    • 2.0.9
    • None
    • None

    Description

      The "nested imports" doesn't work on Maven 2.0.9.

      When trying to resolve "nested imports", Maven 2.0.9 kind of "forget" about the repositories that are defined in settings.xml and only tries to look up some of artifacts in "central" repository.

      Here attaches the sample. The steps to produce this bug under Maven 2.0.9:
      1. unzip this zip and it'll create a folder called "sample". There are 5 POM files under there.
      2. deploy all sample*.xml to a Maven 2 repository by using "deploy:deploy-file".
      3. run "mvn help:effective-pom" and it will fail. The sample/pom.xml imports "sample-1.0.0.0" POM which in turn imports all other sample-pom-[1-3] artifacts. The error messages are as belows. It's trying to look up artifacts ONLY in central repository.

      >mvn help:effective-pom
      [INFO] Scanning for projects...
      Downloading: http://repo1.maven.org/maven2/test-nested-import/sample-pom-1/1.0.0.0/sample-pom-1-1.0.0.0.pom
      [INFO] ------------------------------------------------------------------------
      [ERROR] FATAL ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Failed to resolve artifact.

      GroupId: test-nested-import
      ArtifactId: sample-pom-1
      Version: 1.0.0.0

      Reason: Unable to download the artifact from any repository

      test-nested-import:sample-pom-1:pom:1.0.0.0

      from the specified remote repositories:
      central (http://repo1.maven.org/maven2)

      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      org.apache.maven.reactor.MavenExecutionException: POM 'test-nested-import:sample-pom-1' not found in repository: Unable
      to download the artifact from any repository

      test-nested-import:sample-pom-1:pom:1.0.0.0

      from the specified remote repositories:
      central (http://repo1.maven.org/maven2)
      for project test-nested-import:sample-pom-1
      at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:378)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:292)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      Caused by: org.apache.maven.project.ProjectBuildingException: POM 'test-nested-import:sample-pom-1' not found in reposit
      ory: Unable to download the artifact from any repository

      test-nested-import:sample-pom-1:pom:1.0.0.0

      from the specified remote repositories:
      central (http://repo1.maven.org/maven2)
      for project test-nested-import:sample-pom-1
      at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:6
      03)
      at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:249)
      at org.apache.maven.project.DefaultMavenProjectBuilder.mergeManagedDependencies(DefaultMavenProjectBuilder.java:
      1438)
      at org.apache.maven.project.DefaultMavenProjectBuilder.processProjectLogic(DefaultMavenProjectBuilder.java:1030)

      at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:878)
      at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:253)
      at org.apache.maven.project.DefaultMavenProjectBuilder.mergeManagedDependencies(DefaultMavenProjectBuilder.java:
      1438)
      at org.apache.maven.project.DefaultMavenProjectBuilder.processProjectLogic(DefaultMavenProjectBuilder.java:1030)

      at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:878)
      at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.ja
      va:506)
      at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:198)
      at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:583)
      at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:461)
      at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:365)
      ... 11 more
      Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Unable to download the artifact from any reposi
      tory

      Attachments

        1. sample.zip
          2 kB
          Yan Huang

        Issue Links

          Activity

            People

              Unassigned Unassigned
              azyhuang Yan Huang
              Votes:
              7 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: