尝试在Intellij
中编译我的应用程序时遇到错误:
错误:无法编译Groovy文件:没有为模块定义Groovy库
我在Inteli提示时为模块选择"Configure Groovy SDK"
解决了这个问题。我使用了库org.codehaus.groovy:groovy-all:2.4.4
,然后将此库添加为模块的dependency
。
问题是每次我重新构建我的项目或“刷新gradle项目”在Intellij中我都必须再次“配置Groovy SDK”。
如何设置我的项目,以便我每次都不必重新执行这个步骤?
答案 0 :(得分:8)
在你的pom.xml中添加groovy-all作为依赖项(如果你正在使用maven)或你的build.gradle(用于gradle)。否则每次刷新或同步时,intellij都会删除" extra"它找到的依赖。
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.6</version>
</dependency>