Value of Property "org.gradle.user.home" defined in "gradle.properties" not respected in STS plugin


(Carlo Luib-Finetti) #1

The Gradle cache defaults to “$USER_HOME/.gradle/caches”, but it can be defined to be located elsewhere. I found it a practical thing to have it somewhere relative to some project directory. So I defined it in “gradle.properties” like this:

org.gradle.user.home=/sources/trunk/uvdms/de.uvdms.root/gradleCache

This works fine when using the Gradle cmd line; Gradle then puts downloaded 3rd party jars somewhere below this directory.

My intention was, that this was respected by the STS Eclipse plugin, so that we can have relative path names to these 3rd party jars within Eclipse “.classpath”. But obviousley, the STS plugin does not know of this property and it’s value. So, when Eclipse IDE is initalized, it first does another download of all 3rd party jars into Gradle’s default cache location.


(Radim Kubacki) #2

Are you sure it works for you from command line? http://www.gradle.org/docs/current/userguide/gradle_command_line.html mentions this property without leading org. prefix.

Even then there are some limitations to this like http://issues.gradle.org/browse/GRADLE-2405


(Carlo Luib-Finetti) #3

Yes, it definitely works - because I found there everything the “.classfile” for Eclipse need to resolve external dependencies. I cannot remember where I read that I can do this.

BTW: I created this topic because Adam told me so in issues.gradle.org/Gradle-2756, and also because I’ve found an issue in STS-jira.


(Radim Kubacki) #4

It would be interesting to know what versions of Eclipse, STS Gradle plugin, and Gradle you use. Also if you can add a link to STS JIRA issue I’d be interested.

STS plugin uses Gradle Tooling API to call Gradle and this API expects that Gradle user home is set by call to http://www.gradle.org/docs/current/javadoc/org/gradle/tooling/GradleConnector.html#useGradleUserHomeDir(java.io.File) If I am correct the plugin calls it with the value set in global Eclipse preferences (Window | Preferences | Gradle | Gradle user home (related issue is https://issuetracker.springsource.com/browse/STS-3147). You cannot set it using GRADLE_USER_HOME or using -Dgradle.user.home property at the moment.

BTW: I am still not convinced about the org.gradle.user.home property name. Running gradle with --debug option can tell you if it is applied or not.