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

Harald Wellmann updated MNG-5973:
---------------------------------
    Description: 
h3. Scenario

I'm using $\{maven.multiModuleProjectDirectory\} as part of a property 
definition in my POM:

{noformat}
<properties>
  
<sonar.jacoco.reportPath>$\{maven.multiModuleProjectDirectory\}/target/jacoco.exec</sonar.jacoco.reportPath>
</properties>
{noformat}

(Please ignore the backslashes - I can't find out how to properly escape the 
braces for JIRA.)

This works fine when running Maven from the command line, but when building the 
same project on Jenkins, the variable is not set, there is no error message, 
and my build creates a directory called 
{{/path/to/workspace/$\{maven.multiModuleProjectDirectory\}/target}}.

h3. Analysis

It seems the property {{maven.multiModuleProjectDirectory}} is set in the 
{{bin/mvn}} shell script and not within the Java application. Since Jenkins 
does not use the shell script but has a special way of embedding Maven, this 
explains the effect.

Is there a way to let the Maven Java application compute the property instead 
of having it passed in? If not, can Maven check that the variable is set and 
fail fast otherwise?

At the very least, this special behaviour of 
{{maven.multiModuleProjectDirectory}} should be documented somewhere - up to 
now, I haven't found any user-visible reference to this property except a line 
in the release notes at the time it was introduced.

  was:
h3. Scenario

I'm using $\{maven.multiModuleProjectDirectory\} as part of a property 
definition in my POM:

{noformat}
<properties>
  
<sonar.jacoco.reportPath>$\{maven.multiModuleProjectDirectory\}/target/jacoco.exec</sonar.jacoco.reportPath>
</properties>
{noformat}

(Please ignore the backslashes - I can't find out how to properly escape the 
braces for JIRA.)

This works find when running Maven from the command line, but when building the 
same project on Jenkins, the variable is not set, there is no error message, 
and my build creates a directory called 
{{/path/to/workspace/$\{maven.multiModuleProjectDirectory\}/target}}.

h3. Analysis

It seems the property {{maven.multiModuleProjectDirectory}} is set in the 
{{bin/mvn}} shell script and not within the Java application. Since Jenkins 
does not use the shell script but has a special way of embedding Maven, this 
explains the effect.

Is there a way to let the Maven Java application compute the property instead 
of having it passed in? If not, can Maven check that the variable is set and 
fail fast otherwise?

At the very least, this special behaviour of 
{{maven.multiModuleProjectDirectory}} should be documented somewhere - up to 
now, I haven't found any user-visible reference to this property except a line 
in the release notes at the time it was introduced.


> maven.multiModuleProjectDirectory is not set
> --------------------------------------------
>
>                 Key: MNG-5973
>                 URL: https://issues.apache.org/jira/browse/MNG-5973
>             Project: Maven
>          Issue Type: Bug
>          Components: Bootstrap & Build
>    Affects Versions: 3.3.9
>            Reporter: Harald Wellmann
>
> h3. Scenario
> I'm using $\{maven.multiModuleProjectDirectory\} as part of a property 
> definition in my POM:
> {noformat}
> <properties>
>   
> <sonar.jacoco.reportPath>$\{maven.multiModuleProjectDirectory\}/target/jacoco.exec</sonar.jacoco.reportPath>
> </properties>
> {noformat}
> (Please ignore the backslashes - I can't find out how to properly escape the 
> braces for JIRA.)
> This works fine when running Maven from the command line, but when building 
> the same project on Jenkins, the variable is not set, there is no error 
> message, and my build creates a directory called 
> {{/path/to/workspace/$\{maven.multiModuleProjectDirectory\}/target}}.
> h3. Analysis
> It seems the property {{maven.multiModuleProjectDirectory}} is set in the 
> {{bin/mvn}} shell script and not within the Java application. Since Jenkins 
> does not use the shell script but has a special way of embedding Maven, this 
> explains the effect.
> Is there a way to let the Maven Java application compute the property instead 
> of having it passed in? If not, can Maven check that the variable is set and 
> fail fast otherwise?
> At the very least, this special behaviour of 
> {{maven.multiModuleProjectDirectory}} should be documented somewhere - up to 
> now, I haven't found any user-visible reference to this property except a 
> line in the release notes at the time it was introduced.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to