Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle home cannot be found on Mac

I've installed gradle on MAC using terminal.

brew install gradle

Gradle has been installed successfully.

gradle -v  ------------------------------------------------------------ Gradle 3.3 ------------------------------------------------------------  Build time:   2017-01-03 15:31:04 UTC Revision:     075893a3d0798c0c1f322899b41ceca82e4e134b  Groovy:       2.4.7 Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015 JVM:          1.8.0_112 (Oracle Corporation 25.112-b16) OS:           Mac OS X 10.12.3 x86_64 

but I can not find gradle home.

echo $GRADLE_HOME [empty result] 

the first step to determine home directory is detect location of gradle instruction:

which gradle /usr/local/bin/gradle 

there is incomprehensible bash file.


Any ideas how to detect gradle home directory via terminal?

like image 569
Sergii Avatar asked Jun 05 '17 10:06

Sergii


People also ask

How do I find Gradle home on Mac?

Open Preferences -> Build, Execution, Deployment -> Gradle . Select Use local gradle distribution and specify Gradle home . On Mac: /usr/local/opt/gradle/libexec in case you installed it via brew . For Windows: specify the path where you installed Gradle.

Where is my Gradle home?

The Gradle plugin (which includes a packaged version of gradle) should already be installed at where/you/installed/android-studio/plugins/gradle, so you shouldn't need to download it manually. That last directory may be where/you/installed/android-studio/gradle/gradle-1.1.

How do I know if Gradle is installed Mac?

Verify Gradle Installation. Now open the command prompt. In the command prompt, enter Gradle -version. It will display the current version of Gradle just installed on the screen.


2 Answers

You can use command:

brew info gradle 

As the result you will have something like this:

gradle: stable 4.0.1 Build system based on the Groovy language https://www.gradle.org/ /usr/local/Cellar/gradle/3.4 (181 files, 74.5MB) *   Built from source on 2017-02-24 at 15:01:34 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/gradle.rb ==> Requirements Required: java >= 1.7 ✔ ==> Options --with-all     Installs Javadoc, examples, and source in addition to the binaries 

Here, on the line 4 you can see the home path : /usr/local/Cellar/gradle/3.4

like image 130
dvelopp Avatar answered Sep 18 '22 10:09

dvelopp


You can retrieve the path for GRADLE_HOME automatically using the following snippet in your .bashrc or .zshrc:

export GRADLE_HOME=$(brew info gradle | grep /usr/local/Cellar/gradle | awk '{print $1}') 

This is handy when the path to Gradle's home changes, when Gradle is updated.

like image 38
jokoso Avatar answered Sep 18 '22 10:09

jokoso