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 groo
Groovy can import other groovy classes exactly like Java does. Just be sure the extension of the library file is .groovy.
$ cat lib/Lib.groovy
package lib
class Lib {
static saySomething() { println 'something' }
def sum(a,b) { a+b }
}
$ cat app.gvy
import lib.Lib
Lib.saySomething();
println new Lib().sum(37,5)
$ groovy app
something
42