jenkinsci / jenkinsci/workflow-basic-steps-plugin

[JENKINS-28718] withTool

Open
#393 13 comments 0 reactions 0 assignees View on GitHub
component:workflow-basic-steps-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
73
Forks
129
PR merge metrics
No merged PRs in 30d

Description

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.

---
Originally reported by jglick, imported from: withTool


  • assignee: jglick
  • status: Open
  • priority: Major
  • component(s): workflow-basic-steps-plugin
  • label(s): followup, tools
  • resolution: Unresolved
  • votes: 8
  • watchers: 17
  • imported: 20251215-220547

Raw content of original issue

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.