evaluate(new File("../tools/Tools.groovy"))
Put that at the top of your script. That will bring in the contents of a groovy file (just replace the file name between the double quotes with your groovy script).
I do this with a class surprisingly called “Tools.groovy”.
More Related Contents:
- Split a string in groovy
- How do I get the output of a shell command executed using into a variable from Jenkinsfile (groovy)?
- Groovy executing shell commands
- Understanding the groovy syntax in a gradle task definition
- Creating a Jenkins environment variable using Groovy
- Can you break from a Groovy “each” closure?
- How do I create and access the global variables in Groovy?
- What the difference in applying gradle plugin
- Load script from groovy script
- Get values from properties file using Groovy
- Groovy: what’s the purpose of “def” in “def x = 0”?
- Converting a string to int in Groovy
- How can I use the Jenkins Copy Artifacts Plugin from within the pipelines (jenkinsfile)?
- groovy execute with parameters containing spaces
- Reading file from Workspace in Jenkins with Groovy script
- Groovy different results on using equals() and == on a GStringImpl
- Recommended way to stop a Gradle build
- Difference between Groovy Binary and Source release?
- How to retrieve Jenkins build parameters using the Groovy API?
- Is there a null-coalescing (Elvis) operator or safe navigation operator in javascript?
- What’s the difference of strings within single or double quotes in groovy?
- Groovy Shell warning “Could not open/create prefs root node …”
- How can I fix “unsupported class file major version 60” in IntelliJ IDEA?
- How to access parameters in a Parameterized Build?
- What is the effect of @NonCPS in a Jenkins pipeline script
- BUG! exception in phase ‘semantic analysis’
- Jenkins – abort running build if new one is started
- Groovy: Create a Map with JAX-B Object’s specific attributes
- How do I create an XPath function in Groovy
- What’s wrong with Groovy multi-line String?