I have a file that contains classes. Example :
abstract class TestBase
{
String name
abstract def fTest()
def bobby(){
return \"b
you can do like this:
Classes.groovy
class A{
def greet(name){ return "greet from A: $name!" }
}
class B{
def greet(name){ return "greet from B: $name!" }
}
// this method just to have nice access to create class by name
Object getProperty(String name){
return this.getClass().getClassLoader().loadClass(name).newInstance();
}
return this
pipeline:
node{
def cl = load 'Classes.groovy'
def a = cl.A
echo a.greet("world A")
def b = cl.B
echo b.greet("world B")
}