Issue Details (XML | Word | Printable)

Key: MNG-2896
Type: Wish Wish
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Stefano Bagnara
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Maven 2

${basedir} used in a repository url does not work for parent pom lookup

Created: 24/Mar/07 01:14 PM   Updated: 28/Nov/07 02:51 AM
Component/s: POM
Affects Version/s: 2.0.5
Fix Version/s: Reviewed Pending Version Assignment

Time Tracking:
Not Specified

Issue Links:
Related
 

Complexity: Intermediate


 Description  « Hide
I use something like this to store locally the dependencies.

<repository>
<id>parent-james-stage-m1</id>
<name>James stage repository</name>
<url>file://${basedir}/stage</url>
<layout>legacy</layout>
<releases>
<enabled>true</enabled>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>ignore</checksumPolicy>
</snapshots>
</repository>
----

Everything works fine but the parent resolution: my main pom.xml has a parent and it is not looked up in this repository.
Well, it is lookedup, but ${basedir}
is not expanded and this way the lookup does not work.

If I replace the ${basedir} with my full path everything works fine, but I cannot obviously do that as the local repository is part of the svn tree (by our choice to not use remote repositories).


Furthermore: is there a variable to be used instead of ${basedir} that always reference to its own pom.xml folder? I ask this because I have multiple modules inside this project and I had to add another repository to this pom using file://${basedir}/../stage (notice the ..) so that submodules will use the same repository for the lookups, but this sound like an hack.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Michele Lorenzini added a comment - 17/Oct/07 08:07 AM
I have a similar problem:
in the settings.xml I define a property, say:

<internal.repos.baseurl>http://myinternalreponame/repos</internal.repos.baseurl>

then define a repository using that property, say:
<repository>
<id>myRepo1</id>
<name>My repo</name>
<url>${internal.repos.baseurl}/repo1</url>
</repository>

Now, I have a general parent pom that I have deployed on this repo and a project which uses it.
If I try to "mvn validate" the child project, and I use a "clean" local repository,
maven cannot find the parent pom on the remote repository:

[INFO] Scanning for projects...
[DEBUG] Searching for parent-POM: my.groupid:my-parent::1.0 of project: my.groupid:my-child:jar:1.0 in relative path: ../pom.xml
[DEBUG] Parent-POM: my.groupid:my-parent::1.0 not found in relative path: ../pom.xml
[DEBUG] Retrieving parent-POM: my.groupid:my-parent::1.0 for project: my.groupid:my-child:jar:1.0 from the repository.
[DEBUG] Trying repository myRepo1
Downloading: ${internal.repos.baseurl}/repo1/my/groupid/my-parent/1.0/my-parent-1.0.pom
[DEBUG] Unable to get resource 'my.groupid:my-parent::1.0' from repository myRepo1 (${internal.repos.baseurl}/repo1)

It seems maven does not resolve the property ${internal.repos.baseurl},
if I put the url directly in the repository definition maven finds and gets the parent pom without problems.

The same definition (using the property ${internal.repos.baseurl}) works fine for retrieving dependencies
from the remote repository.

So I suppose the problem is only in the parent pom retrieval when a $ property is used in the <url> element
of a repository config.
Hope it helps