Rather than

      withEnv(["PATH=${tool 'Maven 3.2.2'}/bin:${env.PATH}"]) {sh 'mvn package'}
      

      you should be able to say

      withTool('Maven 3.2.2') {sh 'mvn package'}
      

      where this code builds the environment variables within the block.

          [JENKINS-28718] withTool

          Jesse Glick created issue -
          Jesse Glick made changes -
          Issue Type Original: Bug [ 1 ] New: New Feature [ 2 ]
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-26057 [ JENKINS-26057 ]
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-30372 [ JENKINS-30372 ]
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-34012 [ JENKINS-34012 ]
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-33966 [ JENKINS-33966 ]
          Laurent TOURREAU made changes -
          Link Original: This issue is related to JENKINS-34012 [ JENKINS-34012 ]
          Patrick Wolf made changes -
          Labels Original: tools New: followup tools
          Jesse Glick made changes -
          Epic Link New: JENKINS-35394 [ 171187 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 163573 ] New: JNJira + In-Review [ 181287 ]
          Andrew Bayer made changes -
          Component/s New: pipeline-general [ 21692 ]

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            8 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated: