
Untitled
By: a guest on
May 5th, 2012 | syntax:
None | size: 0.57 KB | hits: 11 | expires: Never
Load script from groovy script
def method() {
println "test"
}
method()
new GroovyShell().parse( new File( 'file1.groovy' ) ).with {
method()
}
class File1 {
def method() {
println "test"
}
}
def script = new GroovyScriptEngine( '.' ).with {
loadScriptByName( 'file1.groovy' )
}
this.metaClass.mixin script
method()
this.class.classLoader.parseClass("src/File1.groovy")
File1.method()
File1.newInstance().anotherMethod()
GroovyShell shell = new GroovyShell()
def script = shell.parse(new File('/path/file1.groovy'))
script.method()