I am new to Jenkins and to groovy scripting, I want to read a .txt file which is located in the workspace of one of the jobs. I am trying to do this way:
myfil
Try this:
file = new File("${Jenkins.instance.getJob('JobName').workspace}/file.txt").text