Hello,

I am not sure this is really what you need, but maybe...
In order to run a method of an object I do the following:

task runAnObjectsMethod << {
  description = "How to run a method of an object"
  dependsOn: compileTestJava
  GroovyShell shell = new GroovyShell(createCompilerConfiguration())
  // need qualifying due to collision with a gradle class
  groovy.lang.Script script = shell.parse(
          'import my.precious.domain.and.MyClass\n'
          + 'd = new MyClass()\n'
          + 'd.aMethod()\n'
          )
  script.run()
}


Here we construct the classpath for the script:

CompilerConfiguration createCompilerConfiguration() {
  CompilerConfiguration cc = new CompilerConfiguration();
  List cp = cc.getClasspath()
  sourceSets.main.runtimeClasspath.each { File file ->
        if (file.isFile()) {
            cp.add(file.getPath())
        }
    }
  cp.add(sourceSets.main.classesDir.getPath())
  cp.add(sourceSets.test.classesDir.getPath())
  cc.setClasspathList( cp)
  return cc
}
-- 
View this message in context: 
http://gradle.1045684.n5.nabble.com/How-to-remove-build-classes-folder-from-runtimeClasspath-tp3332945p3333958.html
Sent from the gradle-user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to