How do I tell IntelliJ about groovy installed with brew on OSX

JavaMacosIntellij IdeaGroovy

Java Problem Overview


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?

Java Solutions


Solution 1 - Java

  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

Solution 2 - Java

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 Project Framework Support

  • 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...

  • browse /usr/local/Cellar/groovysdk//libexec/ e.g: /usr/local/Cellar/groovysdk/2.4.11/libexec/

    Gotcha - It does show file browser that does not let you view your /usr/local file path, you need to press shift + command + g will open a dialog where you can type the path of any folder that you want to open

Done.

Solution 3 - Java

/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

Solution 4 - Java

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.

Solution 5 - Java

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

Solution 6 - Java

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDavidView Question on Stackoverflow
Solution 1 - JavaOmer van KloetenView Answer on Stackoverflow
Solution 2 - Javaf-societyView Answer on Stackoverflow
Solution 3 - JavateppicView Answer on Stackoverflow
Solution 4 - JavaWillView Answer on Stackoverflow
Solution 5 - JavaRB7View Answer on Stackoverflow
Solution 6 - JavaFusca SoftwareView Answer on Stackoverflow