Configuring Groovy SDK within IntelliJ IDEA

大憨熊 提交于 2020-12-02 00:22:50

问题


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?


回答1:


IntelliJ IDEA expects the standard Groovy SDK layout which is provided with the official distributions available at http://groovy-lang.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.




回答2:


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



回答3:


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.




回答4:


  1. From the main menu select File | Project Structure ⌘;.
  2. 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.



来源:https://stackoverflow.com/questions/46123890/configuring-groovy-sdk-within-intellij-idea

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!