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

property in settings.xml not interpolated when resolving parent POM from remote repository

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Incomplete
    • 2.0.9
    • None
    • None
    • Java 1.5.0_11, Windows XP

    Description

      The objective was to use a property in the settings.xml within a profile. This property represents the remote repository host/port number. This is so that multiple entries of the host/port in the settings.xml profiles do not need to be edited when the host/port value changes.

      When working in a project whose parent POM is not installed in the local repository, download of the parent POM from the remote repository fails. If the host/port literal value is substituted in the repository element contained in the settings.xml profile, the download succeeds.

      If the parent POM is installed in the local repository resolution succeeds (of course we don't need the remote repository in this case unless trying to update the SNAPSHOT).

      Attached example files.
      1 - settings.xml file used in ~/.m2/
      2 - pom.xml for base-pom
      3 - pom.xml for child

      To reproduce this problem:

      1) deploy parent POM to remote repository (I use Artifactory which has an upload utility, so I didn't need to install parent POM in the local repository)
      2) verify that parent POM is not in the local repository
      3) try a 'mvn clean' or similar command in the child project - this operation fails (see below)
      4) If the literal host/port value is put into the settings.xml repository element instead of ${repo-host}, the operation will succeed

      [INFO] Scanning for projects...
      [INFO] snapshot com.foo:base-pom:1-SNAPSHOT: checking for updates from central
      [WARNING] repository metadata for: 'snapshot com.foo:base-pom:1-SNAPSHOT' could not be retrieved
      from repository: central due to an error: Error transferring file
      [INFO] Repository 'central' will be blacklisted
      [INFO] ------------------------------------------------------------------------
      [ERROR] FATAL ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Failed to resolve artifact.

      GroupId: com.foo
      ArtifactId: base-pom
      Version: 1-SNAPSHOT

      Reason: Unable to download the artifact from any repository

      com.foo:base-pom:pom:1-SNAPSHOT

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

      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      org.apache.maven.reactor.MavenExecutionException: Cannot find parent: com.foo:base-pom for project:
      com.bar:child:jar:0.0.1-SNAPSHOT for project com.bar:child:jar:0.0.1-SNAPSHOT
      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: Cannot find parent: com.foo:base-pom f
      or project: com.bar:child:jar:0.0.1-SNAPSHOT for project com.bar:child:jar:0.0.1-SNAPSHOT
      at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBu
      ilder.java:1370)
      at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuil
      der.java:821)
      at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMa
      venProjectBuilder.java: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.project.ProjectBuildingException: POM 'com.foo:base-pom' not found in re
      pository: Unable to download the artifact from any repository

      com.foo:base-pom:pom:1-SNAPSHOT

      from the specified remote repositories:
      central (http://repo1.maven.org/maven2)
      for project com.foo:base-pom
      at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenP
      rojectBuilder.java:603)
      at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBu
      ilder.java:1366)
      ... 17 more
      Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Unable to download the arti
      fact from any repository

      com.foo:base-pom:pom:1-SNAPSHOT

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

      at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolve
      r.java:212)
      at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolve
      r.java:74)
      at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenP
      rojectBuilder.java:556)
      ... 18 more
      Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to download the artifact fro
      m any repository
      at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.jav
      a:331)
      at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolve
      r.java:200)
      ... 20 more
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 3 seconds
      [INFO] Finished at: Tue Jun 03 07:57:24 PDT 2008
      [INFO] Final Memory: 8M/35M
      [INFO] ------------------------------------------------------------------------

      Attachments

        1. parent-and-child.zip
          2 kB
          Pat Podenski
        2. pom.xml
          0.6 kB
          Pat Podenski
        3. pom.xml
          0.5 kB
          Pat Podenski
        4. settings.xml
          0.7 kB
          Pat Podenski

        Issue Links

          Activity

            People

              Unassigned Unassigned
              stug23 Pat Podenski
              Votes:
              5 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: