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:
Steps to reproduce:
- Download and unzip attached test project
- cd to unzipped folder and mvn clean verify
- Take a look at contained DefaultInvokerIT