Uploaded image for project: 'Maven Shared Components'
  1. Maven Shared Components
  2. MSHARED-261

DefaultInvoker does not set M2_HOME

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • maven-invoker-2.2
    • maven-invoker
    • None
    • * Win7 x64
      * JDK 6

    Description

      Problem:
      Recently, some of our releases failed because the maven-release-plugin has not re-used the Maven installation with which it was launched to perform the actual release goals. It was noticeable that the release plugin has used the Maven installation where the M2_HOME variable of the current machine has pointed to...

      After some investigation, I figured out, that the DefaultInvoker doesn't propagate the Maven home directory to the M2_HOME env var of invoked Maven processes but uses the mvn.bat of those Maven. The problem ist, that mvn.bat at first looks-up for M2_HOME to launch the Maven which is located there... So, if M2_HOME is already set this takes effect and not the Maven where the invoked mvn.bat is contained in...

      Workaround for release problem:
      Configure release plugin to use the Maven executor 'forked-path' instead of 'invoke'

      Workaround when using Invoker:
      request.addShellEnvironment("M2_HOME", invoker.getMavenHome().getAbsolutePath());

      Steps to reproduce:

      1. Download and unzip attached test project
      2. cd to unzipped folder and mvn clean verify
      3. Take a look at contained DefaultInvokerIT

      Attachments

        1. maven-invocation-its.zip
          4 kB
          Bernd Mathiske

        Activity

          People

            rfscholte Robert Scholte
            bernd Bernd Mathiske
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: