我有一个 groovy 脚本,需要在外部 groovy 脚本内的类中运行一个方法。我知道如何在外部 groovy 脚本中运行方法:
new GroovyShell().parse( new File( 'foo.groovy' ) ).with {
method()
}
但是如果方法在一个类中呢?我试过这个,但它给了我一个错误。
new GroovyShell().parse( new File( 'foo.groovy' ) ).with {
theclass.method()
}