Я опоздал на это, но.Вот как мы добились того, о чем вы просили.Итак, у меня есть file1.gsh, например, так:
File1:
println("this is a test script")
def Sometask(param1, param2, param3)
{
retry(3){
try{
///some code that uses the param
}
catch (error){
println("Exception throw, will retry...")
sleep 30
errorHandler.call(error)
}
}
}
return this;
И в другом файле эти функции могут быть доступны путем создания экземпляра в первую очередь.Так в файле2.
Файл2:
def somename
somename = load 'path/to/file1.groovy'
//the you can call the function in file1 as
somename.Sometask(param1, param2, param3)