Groovy 在 Intellij 中存在冲突

Groovy conflicting in Intellij

我在 Intelij 中有一个 groovy 项目,当我尝试使用 gradle 构建我的项目时,我收到有关 groovy 版本冲突的消息。

"Conflicting module versions, Module[groovy-all is loaded in version 2.4.3 and you trying to load version 2.4.5"

我进入项目设置,然后从我的项目库中删除 groovy 2.5,这一直有效,直到我再次 运行 我的构建脚本,它为我的正常 groovy 和 2.5 加载了 2.3用于我的 groovy 测试。

下面是我的 gradle 脚本,有没有一种方法可以只加载一个版本的 groovy 用于测试和正常目的。

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath "io.ratpack:ratpack-gradle:1.3.3"
        classpath "com.github.jengelman.gradle.plugins:shadow:1.2.3"
    }
}

apply plugin: "io.ratpack.ratpack-groovy"
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: "idea"
apply plugin: "eclipse"

repositories {
    jcenter()
}

dependencies {
    // Default SLF4J binding.  Note that this is a blocking implementation.
    // See here for a non blocking appender http://logging.apache.org/log4j/2.x/manual/async.html
    runtime 'org.slf4j:slf4j-simple:1.7.12'

    testCompile "org.spockframework:spock-core:1.0-groovy-2.4"
    testCompile "org.gebish:geb-spock:0.13.1"
    testCompile "org.seleniumhq.selenium:selenium-firefox-driver:2.44.0"
    testCompile "org.seleniumhq.selenium:selenium-support:2.52.0"
    testCompile 'io.ratpack:ratpack-remote-test:1.2.0'

    // http://mvnrepository.com/artifact/com.google.inject/guice
    compile group: 'com.google.inject', name: 'guice', version: '3.0'

    compile 'io.ratpack:ratpack-handlebars:1.2.0'
    compile 'com.fasterxml.jackson:jackson-parent:2.7-1'
    compile 'postgresql:postgresql:9.1-901-1.jdbc4'
    compile ratpack.dependency("hikari")
}

您需要从 Spock 依赖项中排除 groovy

testCompile("org.spockframework:spock-core:1.0-groovy-2.4") {
    exclude group:'org.codehaus.groovy'
}

您总能找到导致错误依赖的原因,方法是使用

gradle dependencies

并查看输出