Hi all,

I have a groovy script I want to execute from gradle. I would normally just
use the GroovyShell in my task:

task whatever << {
  new GroovyShell().evaluate(script)
}

but the script imports some classes from my classpath and the above claims
they're not found. I tried using a CompilerConfiguration:

def config = new
org.codehaus.groovy.control.CompilerConfiguration(classpath:sourceSets.main.runtimeClasspath)
new GroovyShell(new Binding(), config).evaluate(script)

but again the classes in the script aren't found.

How do I set the classpath in the GroovyShell so that I can execute the
script? Is there a better way to do this than what I'm trying? I know
there's a JavaExec task, but I don't see a GroovyExec task and it seems a
bit strange to artificially wrap my script in a Java program just to run
this.

Thanks,

Ken Kousen
-- 
Kenneth A. Kousen
President
Kousen IT, Inc.

Reply via email to