Java 我如何告诉 IntelliJ 关于在 OSX 上安装了 brew 的 groovy
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41110256/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I tell IntelliJ about groovy installed with brew on OSX
提问by David
I'm running:
我在跑:
- IntelliJ Ultimate 2016.3
- Homebrew 1.1.2
- OS X 10.11.5 El Capitan
- IntelliJ Ultimate 2016.3
- 自制 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
我跑brew install groovy
了导致 groovy 安装在/usr/local/Cellar/groovy/2.4.7/
. Brew 还添加了一个符号链接:/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".
当我在 IntelliJ 中打开 groovy 项目时,它为我提供了一个配置 Groovy SDK 的选项。我还没有设置它,所以我得到一个“创建”按钮,它启动查找器。据我所知,我无法选择让 IntelliJ 满意。我试过/user/local/bin/groovy
,/user/local/Cellar/groovy
,/user/local/Cellar/groovy/2.4.7
,/user/local/Cellar/groovy/2.4.7/bin
等没有母校,我选择,的IntelliJ不接受库,并继续告诉我“错误:没有指定库”。
Does anyone know how I'm supposed to go about telling IntelliJ where groovy is?
有谁知道我应该如何告诉 IntelliJ groovy 在哪里?
回答by teppic
/usr/local/opt/groovy/libexec
.
/usr/local/opt/groovy/libexec
.
use brew info groovy
to print help:
用于brew info groovy
打印帮助:
==> Caveats
You should set GROOVY_HOME:
export GROOVY_HOME=/usr/local/opt/groovy/libexec
回答by Will
I did this with Intellij IDEA 2016.3 on OS X.
我在 OS X 上使用 Intellij IDEA 2016.3 做到了这一点。
I am able to configure this under Project Settings-> Global Libraries.
我可以在Project Settings-> Global Libraries下进行配置。
Add a new global library by clicking the
+
and selectJava
Navigate to the location
homebrew
installed Groovy,/usr/local/Cellar/groovy/2.4.7
and select all the JAR files in thelibexec/lib
directory.Set the name to
groovy-2.4.7
, or whatever works for you.
通过单击
+
并选择添加新的全局库Java
导航到
homebrew
安装 Groovy的位置,/usr/local/Cellar/groovy/2.4.7
然后选择目录中的所有 JAR 文件libexec/lib
。将名称设置为
groovy-2.4.7
,或任何适合您的名称。
回答by Omer van Kloeten
Install groovysdk:
brew remove groovy brew install groovysdk
Set
GROOVY_HOME
, otherwise Intellij reports as broken installation:export GROOVY_HOME=/usr/local/opt/groovy/libexec
Point IntelliJ to the installed directory, e.g.:
/usr/local/Cellar/groovysdk/2.4.7/libexec
安装groovysdk:
brew remove groovy brew install groovysdk
Set
GROOVY_HOME
,否则 Intellij 报告为安装损坏:export GROOVY_HOME=/usr/local/opt/groovy/libexec
将 IntelliJ 指向安装目录,例如:
/usr/local/Cellar/groovysdk/2.4.7/libexec
回答by Fusca Software
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.
因为我无法在打开的对话框中选择 /usr,所以我曾经使用 finder 的“转到文件夹”功能并为 /usr/local/opt/groovy/libexec 创建了一个最喜欢的条目,该条目有效。
回答by f-society
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
右键单击项目根文件夹,或者如果窗口顶部弹出配置向导,我们可以单击该链接。
选择添加项目框架支持
向下滚动并选择Groovy
如果它没有显示在列表中;这是因为它已经添加了框架。
如果 Groovy 尚未添加到 IntellJ,则选择Create...
浏览 /usr/local/Cellar/groovysdk//libexec/ 例如:/usr/local/Cellar/groovysdk/2.4.11/libexec/
Gotcha - 它确实显示文件浏览器,不允许您查看 /usr/local 文件路径,您需要按
shift + command + g
将打开一个对话框,您可以在其中键入要打开的任何文件夹的路径
Done.
完毕。
回答by RB7
It is very easy to do:
很容易做到:
Install groovy:
安装常规:
brew install groovy
Point IntelliJ to the following directory:
将 IntelliJ 指向以下目录:
/usr/local/Cellar/groovysdk/<version>/libexec
You will see that intellij will get all the required dependencies
您将看到 intellij 将获得所有必需的依赖项