[GRADLE-1616] change the location of the project's .gradle cache Created: 14/Jun/11  Updated: 04/Jan/13  Resolved: 25/Jun/11

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 1.0-milestone-4

Type: New Feature
Reporter: Szczepan Faber Assignee: Szczepan Faber
Resolution: Fixed Votes: 0


 Description   

Reported in zendesk by one of the users:

"Sometimes we need to build from a source tree to which we have no write access. For example, a source tree that lives on an NFS share that is exported read-only. Setting buildDir helps, but gradle still tries to write to the $project/.gradle directory."

It should be possible to change the location of the project's .gradle cache folder.



 Comments   
Comment by Blaine Simpson [ 11/Oct/11 ]

We're discouraged from using milestone 4, and I wonder how much of the milestone 4 work is going to survive. This issue says resolved as of 2011-06-25 but has "Fix version/s" unset. Is this going to make it into milestone 5?

Where will the setting be documented... API for some class, release notes, User Guide?

Will there hopefully be a getter also?

I'm also in need of this since there is an ignorant and fascistic policy at my day job where regular user accounts rarely have a home directory.

Comment by Adam Murdoch [ 11/Oct/11 ]

@Blaine, all the fixes in milestone 4 will be available in milestone 5.

Which .gradle directory do you need to change? ie the one in the user's home directory, or the one in the root project directory?

If it's the one in the user's home directory, you can use the -g option, which has been available for a very long time. You can also use a system property or an environment variable. See http://gradle.org/releases/1.0-milestone-4/docs/userguide/gradle_command_line.html

If it's the one in the root project directory, you can use the --project-cache-dir option.

Comment by Blaine Simpson [ 11/Oct/11 ]

Thanks Adam. It's the $HOME/.gradle/cache, because as I explained, the user base for the project in question usually do not have a home directory.

The constraint that I'm under is that users must be able to run "gradlew taskname" and have it work, just like until now they have run "ant targetname". I can't change a system, that used to just work, fail until users use custom invocations like "gradlew -Dthis=that -Pthis=that taskname".

Comment by Adam Murdoch [ 11/Oct/11 ]

Of course. There are a number of options you have.

The simplest option would be for you to edit the gradlew script to add the 'gradle.user.home' system property to GRADLE_OPTS.

Comment by Blaine Simpson [ 11/Oct/11 ]

Will do. Thank you.

Generated at Wed Jun 30 12:00:05 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.