2

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 API.

Thanks in advance!

ybondar
  • 399
  • 2
  • 18

2 Answers2

3

You don't need to set this. This is the default behavior: tooling API will try to read gradle/wrapper/gradle-wrapper.properties in your project to find appropriate distribution that will be used according to a test in https://github.com/gradle/gradle/blob/7dd276a91d9e22248306584afe04171fd86db529/subprojects/tooling-api/src/test/groovy/org/gradle/tooling/internal/consumer/DistributionFactoryTest.groovy#L44

Radim
  • 4,721
  • 1
  • 22
  • 25
0

you could set the installation to use manually and point it to your existing wrapper directory:

GradleConnector connector = GradleConnector.newConnector();
connector.useInstallation(new File("/Users/Rene/.gradle/wrapper/dists/gradle-1.12-all/2apkk7d25miauqf1pdjp1bm0uo/gradle-1.12"));
Rene Groeschke
  • 27,999
  • 10
  • 69
  • 78