I am getting the below error when i try to access a varble from a groovy file
Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: cd91fd2e-c88b-4bcf-80e8-c1062b0386ca
groovy.lang.MissingPropertyException: No such field found: field java.lang.String servers
In your Groovy file, you have defined servers and source_paths as local variables. If I’m not mistaken, these variables are only accessible within the script where they are defined.
If you’re trying to access these variables from a Jenkins pipeline script, they won’t be available, hence the MissingPropertyException. At least, that’s my understanding.
To make these variables accessible from your Jenkins pipeline script, I think you could return them from your Groovy script.
Then, in your Jenkins pipeline script, you could load the Groovy script and hopefully access the servers and source_paths variables with something like this: