Ayusman
Ayusman

Reputation: 8719

How to change Gradle download location

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

Upvotes: 88

Views: 76282

Answers (7)

Bachtiar Panjaitan
Bachtiar Panjaitan

Reputation: 415

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

Upvotes: 13

a Learner
a Learner

Reputation: 5042

If you want to run gradle tasks through IDE then: You can also set in intelliJ editor>File>settings:

IntelliJ editor

Then restart the IDE.

If you want to run gradle tasks through command line then you have to set GRADLE_USER_HOME in environment system variables. Then restart the pc as others also said.

Upvotes: 2

Nandan Wewhare
Nandan Wewhare

Reputation: 525

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)

Upvotes: 6

musketyr
musketyr

Reputation: 828

You can add following line to your gradle.properties:

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

Upvotes: 5

Devendra B. Singh
Devendra B. Singh

Reputation: 304

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.

Upvotes: 0

GuessWhat
GuessWhat

Reputation: 71

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

Upvotes: 4

Peter Niederwieser
Peter Niederwieser

Reputation: 123910

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

Upvotes: 115

Related Questions