Bernd Vogt created MSHARED-261: ---------------------------------- Summary: DefaultInvoker does not set M2_HOME Key: MSHARED-261 URL: https://jira.codehaus.org/browse/MSHARED-261 Project: Maven Shared Components Issue Type: Bug Components: maven-invoker Environment: * Win7 x64 * JDK 6 Reporter: Bernd Vogt Attachments: maven-invocation-its.zip
*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:* # Download and unzip attached test project # cd to unzipped folder and {{mvn clean verify}} # Take a look at contained {{DefaultInvokerIT}} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira