更新时间:2023-12-05 15:05:34
可以通过load命令返回一个新的类实例,并使用对象调用doStuff"
You can return a new instance of the class via the load command and use the object to call "doStuff"
所以,你会在Thing.groovy"中拥有这个
So, you would have this in "Thing.groovy"
class Thing {
def doStuff() { return "HI" }
}
return new Thing();
你会在你的 dsl 脚本中有这个:
And you would have this in your dsl script:
node {
def thing = load 'Thing.groovy'
echo thing.doStuff()
}
应该将HI"打印到控制台输出.
Which should print "HI" to the console output.
这能满足您的要求吗?