How to change Gradle download location

2019-01-16 15:25发布

问题:

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

回答1:

You can set the GRADLE_USER_HOME environment variable, gradle.user.home system property, or --gradle-user-home command line parameter.



回答2:

You can also try to go in eclipse at window ->preferences -> gradle and change the directory there



回答3:

On android studio just go to File > Settings > Build Execution, Deployment > Gradle > Service directory path choose directory what you want.



回答4:

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.



回答5:

You can add following line to your gradle.properties:

systemProp.gradle.user.home=/tmp/changed-gradle


标签: build gradle