您可以这样:
Classs.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 nameObject getProperty(String name){ return this.getClass().getClassLoader().loadClass(name).newInstance();}return this管道:
node{ def cl = load 'Classes.groovy' def a = cl.A echo a.greet("world A") def b = cl.B echo b.greet("world B")}


