Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Gradle Cache Directory?

Tags:

gradle

Is it possible to set the Gradle cache directory, without having to set the GRADLE_USER_HOME environment variable? I would like the Gradle cache to exist in the same workspace as my code, but it seems this is only possible with a bash script wrapped around Gradle.

To clarify, I'm talking about the Gradle cache that contains resolved dependency files.

like image 200
Eric Avatar asked Jul 25 '16 18:07

Eric


Video Answer


1 Answers

I think this might be useful to you - Appendix D. Gradle Command Line

--project-cache-dir

Specifies the project-specific cache directory. Default value is .gradle in the root project directory.

--gradle-user-home

Specifies the Gradle user home directory. The default is the .gradle directory in the user's home directory

Snippet of it in action - just tested locally:

C:\dev\ws\NYSSIS-Intellij\ear>gradle --gradle-user-home c:\dev\cache-test build
Build initialized to use p12_2014_03_31e-windows-models.jar for ChoiceMaker model                                                                   
:compileJava UP-TO-DATE                                                                                              
:compileGroovy UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:web:compileJava UP-TO-DATE
:web:compileGroovy                                                                  
Download https://repo1.maven.org/maven2/org/codehaus/groovy/groovy-all/2.4.6/groovy-all-2.4.6.pom
Download https://repo1.maven.org/maven2/org/springframework/spring-webmvc/3.2.15.RELEASE/spring-webmvc-3.2.15.RELEASE.pom
Download https://repo1.maven.org/maven2/org/springframework/spring-jdbc/3.2.15.RELEASE/spring-jdbc-3.2.15.RELEASE.pom
Download https://repo1.maven.org/maven2/org/springframework/spring-context-support/3.2.15.RELEASE/spring-context-support-3.2.15.RELEASE.pom
like image 183
Brian Avatar answered Sep 24 '22 05:09

Brian