How to config a Maven Toolchain and how to integrate that with your goal settings
- CloudBees Jenkins Enterprise - Managed Master (CJE-MM)
- CloudBees Jenkins Team (CJT)
- CloudBees Jenkins Platform - Client Master (CJP-CM)
- Jenkins LTS
- Config Provider Plugin 2.15.6
Advantage: In an isolated enviroment you don’t have conflicts
Follow these steps to use Maven Toolchain in Jenkins and integrate it with your goals settings:
1. Install the Config Provider Plugin.
2. Go to “Manage Jenkins -> Managed files”.
3. Click on “Add a new config”.
4. Click on “Maven toolchain” and click submit.
5. Paste there your toolchain file and save.
6. Go to your Maven project job and in the “Build Environment” section, click on “Provided configuration files”, select the toolchain file created and choose a Variable name.
7. Now you can use in your job the variable created.
For the example provided you only have to add
-t $TOOLCHAIN in your Goal of your maven job
Note: You need to have one or several JDK installed on the agent and you have to hardcode their paths in the toolchain (You could have some problem using the path of JDKs installed with the default JDK Installer or with the Custom tools installer)
Option 1 for steps from 1 to 5 and then:
6. Go to your Maven project job and in the “Build Environment” section, click on “Provided configuration files”, select the toolchain file created and choose a Target a fill it with
$HOME/.m2/toolchain.xml (its default location)