Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-43769

Add tokens for tool installations managed by Jenkins

XMLWordPrintable

      I'm managing my Maven toolchains.xml through the config-files-plugin, which supports token expansion through the token-macro-plugin.

      A lot of the entries in my toolchains.xml need to use pathes to tools installed and managed by Jenkins, e.g. different JDK versions.

      It would be great to have an easy way to specify a toolchains.xml with tokens for my tool pathes that are expanded automatically.

      At the moment, I can get something like this using the ENV token and wrapping the usage of my toolchains.xml in a build step that defines appropriate environment variables, but this is quite clunky:

       

      steps {
         withEnv(["JDK17_HOME=${tool 'JDK 1.7.x'}", 
                  "JDK18_HOME=${tool 'JDK 1.8.x'}"] { 
            configFileProvider([configFile(fileId: 'default-toolchain', 
                                variable: 'TOOLCHAINS') { 
               ...
            }
         }
      }
      

      where the managed toolchains.xml contains entries like

      <jdkHome>${ENV,var=JDK17_HOME}/jre</jdkHome>

       

      Instead, it would be a lot nicer to be able to just directly do something like

      <jdkHome>${TOOL,name=JDK 1.7.x}/jre</jdkHome>

      and

      steps {
         configFileProvider([configFile(fileId: 'default-toolchain', 
                             variable: 'TOOLCHAINS') {
             ...
         }
      }

            Unassigned Unassigned
            creckord Carsten Reckord
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: