76

I'm running:

  • IntelliJ Ultimate 2016.3
  • Homebrew 1.1.2
  • OS X 10.11.5 El Capitan

I ran brew install groovy which resulted in groovy being installed in /usr/local/Cellar/groovy/2.4.7/. Brew also added a symlink: /usr/local/bin/groovy -> ../Cellar/groovy/2.4.7/bin/groovy

When I open the groovy project in IntelliJ, it gives me an option to Configure a Groovy SDK. I haven't set this up yet, so I get a "Create" button, which launches finder. From what I can tell there's nothing that I can select to make IntelliJ happy. I've tried /user/local/bin/groovy, /user/local/Cellar/groovy, /user/local/Cellar/groovy/2.4.7, /user/local/Cellar/groovy/2.4.7/bin etc. No mater which I choose, IntelliJ doesn't accept the library and continues to tell me "Error: library is not specified".

Does anyone know how I'm supposed to go about telling IntelliJ where groovy is?

0

6 Answers 6

145
  1. Install groovysdk:

    brew remove groovy
    brew install groovysdk

  2. Set GROOVY_HOME, otherwise IntelliJ reports as broken installation:

    export GROOVY_HOME=/usr/local/opt/groovy/libexec

  3. Point IntelliJ to the installed directory, e.g.:

    /usr/local/Cellar/groovysdk/2.4.7/libexec

8
  • 67
    Use <CMD><shift> <.> to see hidden directory tree in the Finder
    – user2964500
    Commented Jul 27, 2017 at 12:03
  • 3
    That was so painful to figure out - thanks for posting this tip
    – juice
    Commented Sep 30, 2017 at 20:58
  • 6
    you also do cmd + g to navigate to a specific folder
    – kindjacket
    Commented Mar 6, 2018 at 18:29
  • 1
    I managed to browse to this hidden folder (I had to press and hold these keys to make it work). Now Idea doesn't create any SDK, after I "open" that directory. What's wrong now?... Commented Dec 18, 2018 at 16:46
  • 2
    GROOVY_HOME path should have groovysdk and not groovy, isn't it?
    – Arman
    Commented Nov 24, 2020 at 9:53
48
brew install groovysdk
  • Right-Click on Project Root Folder or if a Config Wizard Pops up at the top of your windows we can click that link.

  • Select "Add Framework Support".
    NOTE: if you don't see it, just press ⌘ command⇧ shifta and type "Add Framework Support" (i.e. use the "Find Action" command).

  • Scroll down and select Groovy.

    If it does not show in the list, it's because it already has the framework added.

  • If Groovy has not been added to IntellJ then select Create...

  • navigate to /usr/local/Cellar/groovysdk/<version>/libexec/.
    E.g: /usr/local/Cellar/groovysdk/2.4.11/libexec/

Gotcha: if it shows the file browser, bit does not let you view your /usr/local file path, you need to press ⇧ shift⌘ commandg to open a dialog where you can type the path of any folder that you want to open.

Done.

2
  • I just tried with IntelliJ 2019.2.3 and shift + command + g wasn't needed. Commented Oct 9, 2019 at 11:16
  • 1
    This actually works with the 2019 versions of IntelliJ. Nothing else posted here worked (or was specific enough). Commented Jan 3, 2020 at 13:52
16

/usr/local/opt/groovy/libexec.

use brew info groovy to print help:

==> Caveats
  You should set GROOVY_HOME:
    export GROOVY_HOME=/usr/local/opt/groovy/libexec
1
  • 3
    This was useful to know, but ultimately didn't fix things. I think there might be a problem on the intelliJ side. It wound up wanting a folder named groovy-x.y.z, which I got manually from the Groovy website and unzipped under ~/tools/groovy-x.y.z/
    – David
    Commented Dec 13, 2016 at 16:23
14

I did this with Intellij IDEA 2016.3 on OS X.

I am able to configure this under Project Settings -> Global Libraries.

  1. Add a new global library by clicking the + and select Java

  2. Navigate to the location homebrew installed Groovy, /usr/local/Cellar/groovy/2.4.7 and select all the JAR files in the libexec/lib directory.

  3. Set the name to groovy-2.4.7, or whatever works for you.

1
  • Only thing that worked for me. IntelliJ does not make this easy.
    – etech
    Commented Nov 30, 2022 at 21:59
5

It is very easy to do:

Install groovy:

brew install groovy

Point IntelliJ to the following directory:

/usr/local/Cellar/groovysdk/<version>/libexec

You will see that intellij will get all the required dependencies

1
  • there is no folder as groovysdk in Cellar?
    – user124
    Commented Jul 4, 2021 at 1:01
2

Because I could not select /usr in the open dialog, I used to 'go to folder' function of finder and created a favorite entry for /usr/local/opt/groovy/libexec which worked.

2
  • 3
    cmd + shift + . will show "hidden" folders such as /usr
    – Troup
    Commented Mar 5, 2018 at 20:51
  • you can also open it via open /path/to/folder in terminal and then drag that folder to the favorites bar. Commented Mar 25, 2020 at 18:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.