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

maven.multiModuleProjectDirectory is not set

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 3.3.9
    • None
    • Bootstrap & Build
    • None

    Description

      Scenario

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

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

      (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.

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            hwellmann Harald Wellmann
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: