Intellij groovy:错误:无法编译Groovy文件:没有为模块"groovyTest"定义Groovy库 [英] Intellij groovy: Error:Cannot compile Groovy files: no Groovy library is defined for module 'groovyTest'

查看:1173
本文介绍了Intellij groovy:错误:无法编译Groovy文件:没有为模块"groovyTest"定义Groovy库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Intellij在Groovy中创建一个Hello World.我正在使用最新的Intellij:

I'm attempting a Hello World in Groovy using Intellij. I'm using the latest Intellij:

我使用sdkman安装了Groovy: 当我创建一个新的Groovy项目时,它会识别出我已经安装了Groovy

I installed Groovy using sdkman: When I create a new Groovy project it recognizes that I have Groovy installed

当我在src目录中创建一个常规文件并尝试运行它时 我收到错误Error:Cannot compile Groovy files: no Groovy library is defined for module 'new-groovy'

When I create a groovy file in the src directory and try to run it I get the error Error:Cannot compile Groovy files: no Groovy library is defined for module 'new-groovy'

因此,然后我检查项目结构中的模块,并且groovy确实显示在依赖项中(这是我的情况不同于

So then I check my module in Project Structure and groovy does show up in the dependencies (this is where my case differs from the previously accepted answer to this error)

Groovy也被列为库(我不知道为什么PHP被列为每个新项目的库)

Groovy is also listed as a library (I don't know why PHP is listed as a library for every single new project)

我尝试了将下拉列表中的值从compile更改为其他选项,选中和取消选中Export选项的不同组合.在观看上述步骤的在线演示时,我看不到设置的任何不同之处.

I tried different combinations of changing the value in the dropdown from compile to the other options, checking and unchecking the Export option. In watching online demonstrations of the above steps I can't see anything different in my setup.

推荐答案

唯一可行的方法是删除所有Intellij/Jetbrains全局配置文件.我进入~/Library/Preferences并删除了文件名中包含Jetbrains或Intellij的所有内容.在过去的两年中,我一直在多个版本中重复使用配置文件.它赶上了我. Groovy文件将立即编译.

The only thing that worked was deleting all of my Intellij/Jetbrains global config files. I went into ~/Library/Preferences and deleted anything that had Jetbrains or Intellij in its filename. I have been reusing the config files for the past two years across several versions. It caught up with me. Groovy files will compile now.

这篇关于Intellij groovy:错误:无法编译Groovy文件:没有为模块"groovyTest"定义Groovy库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆