I have some library scripts: lib1.groovy:
def a(){
}
lib2.groovy:
def b(){
}
lib3.groovy:
def c(){
}
and want to use them in another scripts : conf.groovy:
a()
b()
c()
conf.groovy is configured by user and he is not aware of my background lib scripts! he is only aware of provided methods/task : a(), b(), c(). actually i created lib scripts for user simplicity.
Is there any way to include all scripts in a lib directory (scripts lib1, lib2m ,lib3) into conf.groovy script(s)? Or, is there any alternative mechanism to to that? I am trying to run conf.groovy in a runner script/java class (using groovy shell, loader o script engine).
main.groovy:
File currentDir = new File(".")
String[] roots = {currentDir.getAbsolutePath()}
GroovyScriptEngine gse = new GroovyScriptEngine(roots)
gse.run('confg.groovy', binding)