Configuring Groovy SDK within IntelliJ IDEA
Intellij IdeaGroovyJenkins PipelineIntellij Idea Problem Overview
I am running IntelliJ IDEA 2017.2.3. I installed Groovy 2.4.12 via Homebrew (OS X). When I open a Groovy source file (or a Jenkinsfile
), I get the following:
>Groovy SDK is not configured for module 'my-module' . . . . . Configure Groovy SDK...
Clicking "Configure Groovy SDK..." leads me to the following dialog:
I tried hitting "Create..." and selecting many different Groovy-related folders and executables, but nothing works.
How can I get IntelliJ IDEA to accept my Groovy SDK?
Intellij Idea Solutions
Solution 1 - Intellij Idea
IntelliJ IDEA expects the standard Groovy SDK layout which is provided with the official distributions available at https://groovy.apache.org/download.html. Just download, unpack into any directory, specify this directory as the library home.
Homebrew package layout may be different, however it may have the standard layout in the libexec
subdirectory in some cases. Try /usr/local/opt/groovy/libexec
(use Cmd + Shift + G to navigate to it).
Solution 2 - Intellij Idea
Another suggestion to add to this solution here described in MAC OS you can also add symbolic link in Library. This will make it easy to select it within IntelliJ:
sudo ln -s /usr/local/opt/groovy/libexec /Library/Groovy
Solution 3 - Intellij Idea
This first answer it excellent, but not sufficient. The hidden folder in Mac blocked me one more day. On Mac system, you can press Cmd + Shift + G to invoke the input dialog and input "/usr/local/opt/groovy/libexec" directly to resolve the issue that you cannot find the lib folder.
Solution 4 - Intellij Idea
CrazyCoder gave the correct hints. But some of us use brew as our standard.
brew install groovysdk
In intellij when you get the dialog, as stated by haltTim, Cmd + Shift + G
Navigate to /usr/local/opt/groovysdk/libexec
or the cellar path /usr/local/Cellar/groovysdk/???/libexec
Solution 5 - Intellij Idea
- From the main menu select File | Project Structure ⌘;.
- In the Project Structure dialog, under Platform Settings, select Global Libraries. Image depicting the Intellij environment
Select Global Libraries, if nothing is there, click on add(+) icon at the top.
Then a small dialog box will appear, Select "from Maven", then another dialog box as shown below appears, iamge showing dialog box
Type in Groovy, then several options will pop up, select an option which has groovy:groovy-all and version 2.4.1(change version according to your need) and click ok. then apply and ok,
After this go to the same dialog box, of Configure SDK and select from drop-down.