Each build has a workspace, so you need to find the desired project first. (The terms "job" and "project" are used rather interchangeable in Jenkins - also in the API.)
After that, you can either cross your fingers and just call getWorkspace()
, which is deprecated (see JavaDoc for details).
Or you can find a specific build (e.g. the last), which can give you the workspace used for that specific build via the getWorkspace()
method as it is defined in the AbstractBuild
class.
Example code:
Jenkins.instance.getJob('<job-name>').lastBuild.workspace;