3

I'm using the gradle tooling API to run functional tests for my own build script.

I would like to access tasks' properties, e.g. the destinationDir of a JavaCompile task, and i don't know how to accomplish this.

Simple example:

Snippet in my buildScript (I defined a SourceSet 'openjpa'):

compileOpenjpaJava {
    destinationDir = file(getOpenjpaClassesDir())
}

private String getOpenjpaClassesDir(){
    return "build/classes_openjpa"
}

In my functional test I read about a way to access the tasks, but I cannot access the destinationDir-property.

GradleProject project = connection.getModel(GradleProject.class);
project.tasks.each { myTask ->
    if ("compileOpenjpaJava" == myTask.name) {
        return myTask.destinationDir.absolutePath // brings a runtime error like: unknown property 'destinationDir'
    }
}

A similar question w/o answers is here: Gradle tooling api get task outputs

Is it possible at all to access tasks' properties?

Thanks Jan

Community
  • 1
  • 1
Ed O Neill
  • 169
  • 2
  • 11

0 Answers0