Jenkins : How to add custom tool to my job's build environment

Ivajlo Iliev picture Ivajlo Iliev · Mar 5, 2018 · Viewed 8.2k times · Source

I define a custom tool in Jenkins and I would like to run it during a build. In "https://wiki.jenkins.io/display/JENKINS/Custom+Tools+Plugin" I see the following : "Then, you just need to add the tool requirement to your job's Build Environment" but I cannot find such an option anywhere. Where can I find it? Or is there another way to run the installation of the custom tool?

Answer

Sean C picture Sean C · Jul 6, 2018

Is this a Pipeline? If it is, you can include it in the pipeline file under 'environment', prior to the stages, like so:

pipeline {
  agent any
  options {
    timestamps()
  }
  environment {
      TOOL = tool name: '<tool>', type:     'com.cloudbees.jenkins.plugins.customtools.CustomTool'
  }
  stages {
...
}