How to get the project Extensions in gradle tooling

I’m using gradle tooling and using projectConnection i’m able to get connect to gradle from java. And by using the ModelBuilder i’m able to get the project object also in my java class.

ModelBuilder gradleBuilder = connection.model(GradleProject.class);

But this project object has accessibility to Tasks only. (i.e) project.getTasks() is available . But not project,getExtensions(). How to access the extensions?? is there anyOther way to access the gradle Extensions from Java?

Tooling API does not provide project’s extensions at the moment. Why do you need the extensions?

i’m trying to get the closure in the build file to java… Tooling Api returns the list of task but not extensions.

My case is like parsing the gradle file(say build.gradle) to get the Closure values filled in that. Since gradle parses the build file and set the closure(extensions) value on executing a task . I’m trying to get the extension values from gradle . How to get those value in Java?

It’s possible to access extensions from, say, a plugin written in Java, but not from the tooling API. To achieve strong forward and backwards compatibility, the tooling API only offers a simplified view on the Gradle object model, designed to meet the needs of integrators like IDEs.

Again, what’s your use case?

I have a similar requirement: I am trying to compare two gradle projects (the current one and the last comitted which i get from git via the jgit library) to check for changed global dependency versions for subprojects. These are set via ext.globalVersions = [tapestry: ‘version’] etc…

Is there a possibility to programmatically parse a build.gradle into a project-object via a gradle api to access the extension properties? Otherwise i would simply parse the two files.

Thanks in advance