How to change Gradle download location
BuildGradleBuild Problem Overview
I am starting to learn gradle. However when I am building Spring with Gradle; it downloads the dependency jars to
C:\Users\UserName\.gradle
Is there any way I can specify Gradle to download the dependency jars to a specific location? Just like I can specify repository location in Maven.
System information: Windows 7 64bit Gradle version 1.0
Build Solutions
Solution 1 - Build
You can set the GRADLE_USER_HOME
environment variable, gradle.user.home
system property, or --gradle-user-home
command line parameter.
Solution 2 - Build
On android studio just go to File > Settings > Build Execution, Deployment > Gradle > Service directory path choose directory what you want.
Solution 3 - Build
You can also try to go in eclipse at window ->preferences -> gradle and change the directory there
Solution 4 - Build
You can add following line to your gradle.properties
:
systemProp.gradle.user.home=/tmp/changed-gradle
Solution 5 - Build
If you are using gradle plugin in your eclipse and trying to import the gradle project than your gradle home is set to
C:\Users\UserName.gradle
In some cases your import build model will not work because of your user directory permission issue.
In this case you can copy your .gradle directory from below path
C:\Users\UserName\**.gradle**
paste into some directory where you have all permission and import the project.
In my case i moved my .gradle dir to z drive and than imported the project than made build model and it worked.
Solution 6 - Build
Steps:
- Set the GRADLE_USER_HOME environment variable to new path
- On android studio just go to File > Settings > Build Execution, Deployment > Gradle > Service directory path choose directory what you want.
- Restart the PC (important step, no one mentioned this surprisingly)