Uploaded image for project: 'Maven Release Plugin'
  1. Maven Release Plugin
  2. MRELEASE-879

Custom toolchain configuration is not passed to forked Maven executions



    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5
    • 2.5.2
    • prepare-with-pom
    • None


      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.




            rfscholte Robert Scholte
            sergei_ivanov@mail.ru Sergei S. Ivanov
            0 Vote for this issue
            2 Start watching this issue