Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define Gradle's home in IDEA?

I am trying to import a Gradle project into IntelliJ, and when I get to the Gradle Home textbox, it is not automatically populated, nor will typing in the path of Gradle Home result in a valid location - I have the GRADLE_USER_HOME environment variable set (to what I think is!) the correct path, and I have been able to successfully import this same project into Eclipse. Any suggestions?

like image 515
user2699970 Avatar asked Aug 28 '13 18:08

user2699970


People also ask

How is Gradle home defined?

Open Preferences -> Build, Execution, Deployment -> Gradle . Select Use local gradle distribution and specify Gradle home .

Where can I find Gradle user home?

The default Gradle user home directory is $USER_HOME/. gradle . A property defined in the properties file, in the Gradle user home directory, overrides the property values defined in a properties file in the project directory.

How do I reimport a project in IntelliJ?

Otherwise, from the main menu, select File | New | Project from Existing Sources. In the dialog that opens, select the directory in which your sources, libraries, and other assets are located and click Open. Gradle or Android Gradle: select the necessary build tool and click Finish.


1 Answers

You can write a simple gradle script to print your GRADLE_HOME directory.

task getHomeDir {     doLast {         println gradle.gradleHomeDir     } } 

and name it build.gradle.

Then run it with:

gradle getHomeDir 

If you installed with homebrew, use brew info gradle to find the base path (i.e. /usr/local/Cellar/gradle/1.10/), and just append libexec.

The same task in Kotlin in case you use build.gradle.kts:

tasks.register("getHomeDir") {     println("Gradle home dir: ${gradle.gradleHomeDir}") } 
like image 83
Heath Borders Avatar answered Sep 19 '22 18:09

Heath Borders