How to define Gradle's home in IDEA?

后端 未结 16 582
太阳男子
太阳男子 2020-12-04 04:37

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

16条回答
  •  既然无缘
    2020-12-04 05:16

    This is what helped me solve the problem of not having Gradle home set for the IDEA when importing a Gradle project.

    THREE OPTIONS -- (A) Default Wrapper (B) "gradle 'wrapper' task configuration" OR (C) "local gradle distribution" defined by jetbrains: https://www.jetbrains.com/help/idea/gradle-settings.html

    A. Default Wrapper (recommended)

    If you are able, select this recommended option. If it is grayed out, see option C, which should then set your default for all subsequent projects.

    B. Gradle 'Wrapper' Task Configuration

    If you want IDEA to define your gradle version for you from your build script

    1. Set this option if you define your gradle build versions as a task within your actual gradle build.

    Example below from jetbrains: https://www.jetbrains.com/help/idea/gradle-settings.html

    (useful if you do not want to share gradle builds between projects)

    C. Local Gradle Distribution

    1. Run the following command to get gradle location:
    
       brew info gradle (if gradle was installed with homebrew)
    
    
    2. You are looking for something like this:
    
       /usr/local/Cellar/gradle/4.8.1
    
    
    3. Next, append 'libexec' to the gradle location you just found:
    
    /usr/local/Cellar/gradle/4.8.1/libexec
    

    This is because "libexec is to be used by other daemons and system utilities executed by other programs" (i.e. IDEA). Please see https://unix.stackexchange.com/questions/312146/what-is-the-purpose-of-usr-libexec

    4. Finally, put that new path in the Gradle home input box if IDEA prompts you.
    

    1. IDEA should now have allowed you to hit OK

提交回复
热议问题