Questions tagged [gradle-tooling-api]

The tooling Api operates in a version independent way. This means that you can use the same API to work with different target versions of Gradle. The tooling API is Gradle wrapper aware and, by default, uses the same target Gradle version as that used by the wrapper-powered project.

21 questions
4
votes
5 answers

Gradle - Could not create an instance of Tooling API implementation

I'm trying to import a project from GitHub and build/run it on Android Studio. I am getting the following error: "Error:Could not create an instance of Tooling API implementation using the specified Gradle distribution …
3
votes
1 answer

Get Gradle Plugins programmatically with Gradle tooling api

I am using Gradle tooling API to get different insights about Gradle projects such as project tasks, Gradle version, and more. Part of this analysis requires me to know what plugins were applied (directly and transitively) by the project. I could…
slashms
  • 928
  • 9
  • 26
3
votes
1 answer

Set task properties (or command line args) using Gradle Tooling API

I want to use the Gradle Tooling API to invoke Gradle from an Eclipse plugin through the Buildship plug-ins. I am able to run basic tasks without problems. One of my use cases is to execute the gradle init task in a new project folder, but to work…
Neil Bartlett
  • 23,743
  • 4
  • 44
  • 77
3
votes
1 answer

How can I set gradle project properties when using gradle tooling API?

I'm trying to use the tooling API to run a gradle task from groovy code. The following works: ProjectConnection connection = GradleConnector.newConnector() .forProjectDirectory(new File(System.properties.getProperty('user.dir'))) …
Steve Anderson
  • 334
  • 1
  • 7
3
votes
0 answers

Access tasks' properties via Gradle Tooling API

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…
Ed O Neill
  • 169
  • 2
  • 11
3
votes
3 answers

Gradle Tooling API - Find all tasks for a GradleProject

I'm totally stuck here. I am writing a java class that is supposed to manipulate gradle builds. I've managed to instantiate gradle tooling API (Connector, GradleProject), but neither of these would let me get the plain simple list of all the tasks…
tishma
  • 1,855
  • 1
  • 21
  • 43
3
votes
1 answer

How do I get the plugins applied to a build script using gradle tooling api?

I'm writing an Eclipse plugin and I want to use the gradle tooling api to inspect a gradle project's build script to look whether or not it has certain plugins applied. Lets say that I have a build script that looks something like this: buildscript…
gamerson
  • 5,220
  • 1
  • 28
  • 45
3
votes
0 answers

Suppress internal logging from Gradle tooling API

When I use the Gradle tooling API in my custom plugin, I get a lot of noise at the console, e.g.: Creating ClassLoader af47d36a-0f9f-40d2-8bc3-b32738455061 from system and [org.gradle.internal.classloader.FilteringClassLoader@5aa153ee]. Creating…
David Moles
  • 48,006
  • 27
  • 136
  • 235
2
votes
0 answers

Add Gradle Tasks programmatically to available tasks list using Gradle Tooling API

One can add new tasks to the Task list by declaring new tasks in the build.gradle file Adding the following to build.gradle adds listJars task to the available tasks list. task listJars << { configurations.compile.each { File file -> println…
tr_quest
  • 735
  • 2
  • 10
  • 24
2
votes
1 answer

Gradle Tooling : How to set environment variable

I have a custom plugin and I am writing tests to test it. For this I'm using gradle tooling api (I found that to be the recommended way to test). One of the test requires me to run a task by setting some environment variable. How do I test this. I…
Sundeep Gupta
  • 1,887
  • 3
  • 24
  • 35
2
votes
2 answers

Gradle Tooling API - How to use Gradle wrapper?

I've started using Gradle tooling API and found question: Is there any way to use Gradle wrapper as Gradle installation from Tooling API? I need to ignore any Gradle installation in the system and use Gradle wrapper for target project under Tooling…
ybondar
  • 399
  • 2
  • 18
1
vote
1 answer

Gradle ResultHandler returns null

I want to get results from tasks run by Gradle Tooling. I define ResultHandler, but in method onComplete(Object result) i get null value. After typing gradle cR, I get following output: :returnString UP-TO-DATE BUILD SUCCESSFUL Total time: 0.98…
Grzegorz P
  • 43
  • 2
0
votes
0 answers

Parsing Gradle project to extract project information (group id, artifact id, version)

I'm writing a project that requires me to have a Gradle project's version, group id, and artifact id. I was looking into using something more proper than the solution I have already tried. I have looked into using the Gradle Tooling API. However, it…
Subham
  • 1
0
votes
1 answer

Gradle tooling API + JUnit 5 parallel test execution exceptions (LocationAwareException)

Renamed from: LocationAwareException - org.gradle.tooling.ResultHandler receiving error notifications yet test process is working I am using the Gradle tooling API to kick off tests via a Java Spring Boot service. I am using ScheduledFutures with…
chrismead
  • 2,163
  • 3
  • 24
  • 36
0
votes
1 answer

Passing property to Gradle Tooling API ProjectConnection

I am using gradle tooling api and I encountered the following scenario. There is a project that applies a certain plugin P which creates a task T only if the property shouldApplyP is passed. Hence, if you will run ./gradlew tasks --all you won't see…
slashms
  • 928
  • 9
  • 26
1
2