title: Read .txt file from workspace groovy script in Jenkins
body: <p>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:</p>
  
  <p><code>myfile = Jenkins.instance.getJob('JobName').workspace.readFileFromWorkspace('file.txt');</code></p>
  
  <p>But leads to the following error:</p>
  
  <blockquote>
    <p>groovy.lang.MissingMethodException: No signature of method:
    hudson.FilePath.readFileFromWorkspace() is applicable for argument
    types: (java.lang.String) values: [file.txt]</p>
  </blockquote>