cancel
Showing results for 
Search instead for 
Did you mean: 

Use groovy script from Script Collection inside another groovy script

aftermathematic
Discoverer
0 Kudos
386

Hi experts,

In terms of maximizing the reusability of my Groovy scripts, I am trying to use some custom functions located in CustomFunctions.groovy (which is inside my Script Collection), inside my Main.groovy (also in the same Script Collection).

I've tried to import the CustomFunctions through a GroovyShell but that resulted in a FileNotFoundException.
Any other way I can achieve this? Preferrably through an import statement (and not with a .jar)?

Any help would be much appreciated!
Thanks, Jan

GroovyShell shell = new GroovyShell()
Script script = shell.parse(new File('./CustomFunctions.groovy'))

javax.script.ScriptException: java.io.FileNotFoundException: /home/vcap/app/script/CustomFunctions.groovy (/home/vcap/app/script/CustomFunctions.groovy), cause: java.io.FileNotFoundException: /home/vcap/app/script/CustomFunctions.groovy (/home/vcap/app/script/CustomFunctions.groovy)

Accepted Solutions (0)

Answers (0)