intellij-idea - IntelliJ Idea groovy.lang.GroovyRuntimeException : Conflicting module versions

标签 intellij-idea groovy spring-boot

我的 maven 构建很好,并且能够从 cli 运行 groovy。但是,如果我尝试在 IntelliJ Idea(版本 15 社区版)中运行我的 groovy 类,它会给我以下错误。

Exception in thread "main" java.lang.ExceptionInInitializerError
at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:61)
at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:32)
at groovy.lang.Closure.<init>(Closure.java:219)
at groovy.lang.Closure.<init>(Closure.java:236)
at groovy.lang.Closure$1.<init>(Closure.java:203)
at groovy.lang.Closure.<clinit>(Closure.java:203)
at filter.App.<clinit>(App.groovy)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)
Caused by: groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-all is loaded in version 2.3.9 and you are trying to load version 2.4.5
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$DefaultModuleListener.onModule(MetaClassRegistryImpl.java:509)
    at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromProperties(ExtensionModuleScanner.java:77)
    at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromMetaInf(ExtensionModuleScanner.java:71)
    at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModules(ExtensionModuleScanner.java:53)
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:110)
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:71)
    at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:33)
    ... 10 more

不知道如何摆脱这个。

这是我的 pom 依赖项。
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>2.4.5</version>
    </dependency>

我正在使用 Spring Boot 。
 <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.3.2.RELEASE</version>
    <relativePath></relativePath>
</parent>

这是我安装在系统中的 groovy 版本。
Groovy Version: 2.4.5 JVM: 1.8.0_60 Vendor: Oracle Corporation OS: Linux

如果有人知道这件事,请告诉我。

最佳答案

@SuperAndrew 的建议不是我的情况——我没有在我的项目结构下的 Global Libraries 下注册 Groovy。但我确实找到了 this StackExchange solution resolved my issue .将此代码添加到您的 build.gradle文件。

configurations.all {
    resolutionStrategy {
        force 'org.codehaus.groovy:groovy-all:2.4.4'
    }
}

关于intellij-idea - IntelliJ Idea groovy.lang.GroovyRuntimeException : Conflicting module versions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35520767/

相关文章:

java - 在方法中检查可空变量是否为空但未识别

class - Intellij - 主窗口中只有一个选项卡

android - 如何在Android Gradle插件环境中支持osgi?

java - BST 时间错误

java - 将编译时依赖项写入文件

spring - 如何为每个 block 创建多个文件(csv)?

java - 在 IntelliJ IDEA 11 中运行 Apache Felix 4.0.2

intellij-idea - 给我看你的身份证(E)!

java - 在 Spring Boot 应用程序中使用 MuleClient

java - Spring Boot休息 Controller : Return default Error JSON