Sergei Ivanov created MRELEASE-879:
--------------------------------------
Summary: Custom toolchain configuration is not passed to forked
Maven executions
Key: MRELEASE-879
URL: https://jira.codehaus.org/browse/MRELEASE-879
Project: Maven Release Plugin
Issue Type: Bug
Components: prepare-with-pom
Affects Versions: 2.5
Environment: Apache Maven 3.0.4 (r1232337; 2012-01-17 08:44:56+0000)
Maven home: /opt/app/xxx/uat1/tools/apache-maven-3.0.4
Java version: 1.7.0_07, vendor: Oracle Corporation
Java home: /opt/app/xxx/uat/uat1/tools/jdk/32/jdk1.7.0_07/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "2.6.18-194.32.1.el5", arch: "i386", family: "unix"
Reporter: Sergei Ivanov
We do use maven toolchains extensively, and recently we had to make a change to
pass a custom node-specific toolchain file to our release jobs. We can no
longer have a common toolchain file in {{~/.m2/}} directory, so we started
using {{--toolchain}} command line option instead.
Unfortunately, this did not work well at all with the Maven release process. It
seems that the forked Maven executions (as spawned by {{release:prepare}} and
{{release:perform}} goals) do not inherit the custom toolchain configuration
from the release plugin execution.
Quickly skimming through the release plugin sources, I could not see any
mention of toolchains either.
As far as I can tell, one would need to extend the {{ReleaseEnvironment}} to
pass toolchains file location to the forked Maven process. It should be
possible to extract the location of the toolchains file by calling
{{org.apache.maven.execution.MavenExecutionRequest.getUserToolchainsFile()}}
through Java reflection (in a similar way to what {{getActiveProfileIds()}}
method in {{org.apache.maven.plugins.release.AbstractReleaseMojo}} class does).
I believe {{--toolchains}} option was only introduced in Maven 3.0.4 and the
{{getUserToolchainsFile()}} method may be missing in earlier versions of Maven
Core, in which case the release process should simply fall back to the current
behaviour.
--
This message was sent by Atlassian JIRA
(v6.1.6#6162)