Gradle home cannot be found on Mac

前端 未结 7 1362
野性不改
野性不改 2021-02-01 13:24

I\'ve installed gradle on MAC using terminal.

brew install gradle

Gradle has been installed successfully.

gradle -v

--         


        
相关标签:
7条回答
  • 2021-02-01 13:32

    I've gradle installed When using homebrew, below one failed with me, and kept telling undefined:

    /usr/local/Cellar/gradle/<version>
    

    The below symlink worked perfectly, and solved my issue:

    /usr/local/opt/gradle/libexec
    
    0 讨论(0)
  • 2021-02-01 13:40

    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.

    0 讨论(0)
  • 2021-02-01 13:44

    "brew info gradle" command not always give the installed path

    br*ew info gradle
    gradle: stable 5.6.3
    Open-source build automation tool based on the Groovy and Kotlin DSL
    https://www.gradle.org/
    Not installed
    From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/gradle.rb
    ==> Requirements
    Required: java >= 1.8 ✔
    ==> Analytics
    install: 29,106 (30 days), 144,607 (90 days), 611,211 (365 days)
    install_on_request: 28,237 (30 days), 137,584 (90 days), 577,691 (365 days)
    build_error: 0 (30 days)*
    
    0 讨论(0)
  • 2021-02-01 13:44

    My point isn't enough for commenting on flic's answer in the previous post. If it happens to be in MacOS, the asterisk should be escaped as:

    brew info gradle | sed -nE 's#^(/usr/local/Cellar/gradle/[^ ]+).+\*#\1#p'
    

    or there will be sed: 1: "s#^(/usr/local/Cellar/g ...: RE error: repetition-operator operand invalid" error reported.

    0 讨论(0)
  • 2021-02-01 13:47

    On Mojave, Gradle v6.6, I appended libexec after Gradle version for IntelliJ to work.

    /usr/local/Cellar/gradle/5.4/libexec
    
    0 讨论(0)
  • 2021-02-01 13:48

    On Mojave (v10.14), Gradle v5.4, I had to append libexec after Gradle version for IntelliJ to work.

    /usr/local/Cellar/gradle/5.4/libexec
    
    0 讨论(0)
提交回复
热议问题