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

                 Key: MNG-3612
                 URL: http://jira.codehaus.org/browse/MNG-3612
             Project: Maven 2
          Issue Type: Bug
          Components: Inheritance and Interpolation
    Affects Versions: 2.0.9
         Environment: Java 1.5.0_11, Windows XP
            Reporter: Pat Podenski
         Attachments: pom.xml, pom.xml, settings.xml

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] ------------------------------------------------------------------------


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to