I have read how to simply import a groovy file in another groovy script
I want to define common functions in one groovy file and call those functions from other groovy files.
I understand this would be using Groovy like a scripting language i.e, I dont need classes/objects. I am trying to something like dsl that can be done in groovy. All variables will be asserted from Java and I want to execute groovy script in a shell.
Is this possible at all ? Can someone provide some example.
Best Answer
Put that at the top of your script. That will bring in the contents of a groovy file (just replace the file name between the double quotes with your groovy script).
I do this with a class surprisingly called "Tools.groovy".