[ 
https://issues.apache.org/jira/browse/MNG-7088?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Monkey updated MNG-7088:
------------------------
    Description: 
Maven docs say that ${project.basedir} points to the directory containing the 
pom.xml file, but does not say, which pom.xml file. As it turns out in the 
example below, it can be the file in the directory where mvn is called, and not 
really the file where the property is used.

If the problems as the one below cannot be resolved cleanly,  would adding a 
property, which always points to pom.xml own directory, help?

I am sorry for the formatting, it is the system which puts new paragraphs and 
brackets for whatever reason.

I have a Maven child project in a directory "child". I have also a parent 
project "local-lib" in the directory "child/local-lib" which contains a 
repository with jars. The repository is declared in "child/local-lib/pom.xml" as

{{<repositories>}}
{{ <repository>}}
{{ <id>repo</id>}}
{{ <url>[file:///$]}}{{{project.basedir}/repo</url>}}
{{ </repository>}}
{{ </repositories>}}
 
 The child project has "child/pom.xml" where it refers to its parent as follows:
 
 {{<parent>}}
{{ <groupId>someGroup</groupId>}}
{{ <artifactId>local-lib</artifactId>}}
{{ <version>0.0.1</version>}}
{{ <relativePath>./local-lib</relativePath>}}
{{ </parent>}}
 
 When I type "mvn clean install" in the child project, that is, in the 
directory "child", the child project attempts to search for a non-existing 
repository "child/repo", instead of "child/local-lib/repo". However, replacing 
"${project.basedir}" in "child/local-lib/pom.xml" with the full path to 
"child/local-lib" on my disk makes the child project use the correct repository 
child/local-lib/repo. This in turn, placed in child/local-lib/pom.xml as 
before, but with additional "local-lib":
 
 {{<repositories>}}
{{ <repository>}}
{{ <id>repo</id>}}
{{ <url>[file:///$]{project.basedir}/local-lib/repo</url>}}
{{ </repository>}}
{{ </repositories>}}

works this time correctly if I use maven from the directory "child", but not if 
I use directly "child/local-lib/pom.xml" from "child/local-lib". The latter 
creates a path with local-lib included twice.

 

  was:
If the problems as the one below cannot be resolved cleanly,  would adding a 
property which always points to pom.xml own directory help?

I am sorry for the formatting, it is the system which puts new paragraphs and 
brackets for whatever reason.

I have a Maven child project in a directory "child". I have also a parent 
project "local-lib" in the directory "child/local-lib" which contains a 
repository with jars. The repository is declared in "child/local-lib/pom.xml" as

{{<repositories>}}
{{ <repository>}}
{{ <id>repo</id>}}
{{ <url>[file:///$]}}{{{project.basedir}/repo</url>}}
{{ </repository>}}
{{ </repositories>}}
 
 The child project has "child/pom.xml" where it refers to its parent as follows:
 
 {{<parent>}}
{{ <groupId>someGroup</groupId>}}
{{ <artifactId>local-lib</artifactId>}}
{{ <version>0.0.1</version>}}
{{ <relativePath>./local-lib</relativePath>}}
{{ </parent>}}
 
 When I type "mvn clean install" in the child project, that is, in the 
directory "child", the child project attempts to search for a non-existing 
repository "child/repo", instead of "child/local-lib/repo". However, replacing 
"${project.basedir}" in "child/local-lib/pom.xml" with the full path to 
"child/local-lib" on my disk makes the child project use the correct repository 
child/local-lib/repo. This in turn, placed in child/local-lib/pom.xml as 
before, but with additional "local-lib":
 
 {{<repositories>}}
{{ <repository>}}
{{ <id>repo</id>}}
{{ <url>[file:///$]{project.basedir}/local-lib/repo</url>}}
{{ </repository>}}
{{ </repositories>}}

works this time correctly if I use maven from the directory "child", but not if 
I use directly "child/local-lib/pom.xml" from "child/local-lib". The latter 
creates a path with local-lib included twice.

 


> A property which points to pom.xml own directory
> ------------------------------------------------
>
>                 Key: MNG-7088
>                 URL: https://issues.apache.org/jira/browse/MNG-7088
>             Project: Maven
>          Issue Type: New Feature
>    Affects Versions: 3.6.3
>            Reporter: Monkey
>            Priority: Major
>
> Maven docs say that ${project.basedir} points to the directory containing the 
> pom.xml file, but does not say, which pom.xml file. As it turns out in the 
> example below, it can be the file in the directory where mvn is called, and 
> not really the file where the property is used.
> If the problems as the one below cannot be resolved cleanly,  would adding a 
> property, which always points to pom.xml own directory, help?
> I am sorry for the formatting, it is the system which puts new paragraphs and 
> brackets for whatever reason.
> I have a Maven child project in a directory "child". I have also a parent 
> project "local-lib" in the directory "child/local-lib" which contains a 
> repository with jars. The repository is declared in "child/local-lib/pom.xml" 
> as
> {{<repositories>}}
> {{ <repository>}}
> {{ <id>repo</id>}}
> {{ <url>[file:///$]}}{{{project.basedir}/repo</url>}}
> {{ </repository>}}
> {{ </repositories>}}
>  
>  The child project has "child/pom.xml" where it refers to its parent as 
> follows:
>  
>  {{<parent>}}
> {{ <groupId>someGroup</groupId>}}
> {{ <artifactId>local-lib</artifactId>}}
> {{ <version>0.0.1</version>}}
> {{ <relativePath>./local-lib</relativePath>}}
> {{ </parent>}}
>  
>  When I type "mvn clean install" in the child project, that is, in the 
> directory "child", the child project attempts to search for a non-existing 
> repository "child/repo", instead of "child/local-lib/repo". However, 
> replacing "${project.basedir}" in "child/local-lib/pom.xml" with the full 
> path to "child/local-lib" on my disk makes the child project use the correct 
> repository child/local-lib/repo. This in turn, placed in 
> child/local-lib/pom.xml as before, but with additional "local-lib":
>  
>  {{<repositories>}}
> {{ <repository>}}
> {{ <id>repo</id>}}
> {{ <url>[file:///$]{project.basedir}/local-lib/repo</url>}}
> {{ </repository>}}
> {{ </repositories>}}
> works this time correctly if I use maven from the directory "child", but not 
> if I use directly "child/local-lib/pom.xml" from "child/local-lib". The 
> latter creates a path with local-lib included twice.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to