0

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

“模块版本冲突,Module[groovy-all 在 2.4.3 版中加载,而您尝试加载 2.4.5 版”

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

下面是我的 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")
}
4

1 回答 1

4

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

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

通过使用,您始终可以找到导致错误依赖的原因

gradle dependencies

并查看输出

于 2016-06-13T20:13:08.493 回答