Running pure Groovy code in a step inside a Jenkinsfile

sh, as other Jenkins steps, started in current workspace directory.

So, you could replace native java/groovy new File with Jenkins readFile and the rest of your code should work.

readFile("settings.gradle").readLines()...

Or specify the full path for new File

new File("${WORKSPACE}/settings.gradle").readLines()...

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top