loading other scripts from a groovy script?

Posted by IttayD on Stack Overflow See other posts from Stack Overflow or by IttayD
Published on 2010-05-20T12:57:26Z Indexed on 2010/05/20 13:00 UTC
Read the original article Hit count: 219

Filed under:

How can I load other scripts from within a groovy script? In particular, I want this:

in file A.groovy:

def say(String msg) {
  println(msg)
}
say("hi")

in file B.groovy:

load("A.groovy")
say("bye")

running 'groovy B.groovy' should print

hi
bye

© Stack Overflow or respective owner

Related posts about groovy