How to change the default .gradle local directory ($User_Home\.gradle) to other directory (like D:\.gradle)?

How to change the default .gradle local directory ($User_Home.gradle) to other directory (like D:.gradle)?

There are several ways to do this as indicated in this blog: http://mrhaki.blogspot.in/2010/09/gradle-goodness-changing-gradle-user.html

One of the easiest is to define the environment variable GRADLE_USER_HOME to the custom path.

You can also pass this as Java environment variable through in GRADLE_OPTS or JAVA_OPTS environment variables or even pass it as a command line argument (as indicated in the blog).