Search code examples
macosgradlemacports

Gradle on Mac installed using MacPorts: where is Gradle home?


I installed Gradle using MacPorts and now I am unable to find where the Gradle home is. For example Eclipse asks me for the location and I have no idea:

Eclipse asking me for Gradle home

I tried specifying the path obtained from which gradle:

$ which gradle
/opt/local/bin/gradle

But it does not work. So, where is the Gradle home?


Solution

  • It turns out that MacPorts tells you the Gradle home when installing / upgrading Gradle. The installation log ends with the following:

    --->  Some of the ports you installed have notes:
      gradle has the following notes:
        Remember to set the environment variable GRADLE_HOME 
        to the path to the gradle distribution:
        /opt/local/share/java/gradle
    

    So the correct Gradle home in that case is:

    /opt/local/share/java/gradle
    

    And this works in the Eclipse scenario mentioned above.