【问题标题】:Groovy conflicting in IntellijIntellij 中的 Groovy 冲突
【发布时间】:2016-10-14 09:02:59
【问题描述】:

我在 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")
}

【问题讨论】:

  • 为什么要标记 Grails?
  • 把它切换到了ratpack。我猜你的意思是老鼠包

标签: intellij-idea groovy ratpack


【解决方案1】:

你需要从 Spock 依赖中排除 groovy

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

你总能找到导致错误依赖的原因,通过使用

gradle dependencies

并查看输出

【讨论】:

  • 我已将其添加到 spock 中,但问题仍然存在
  • geb 也很时髦吗?
  • 是的,从 Geb 中排除了 Groovy,现在它可以完美运行了。谢谢
猜你喜欢
  • 2012-07-08
  • 1970-01-01
  • 2022-01-03
  • 1970-01-01
  • 2020-09-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-09-05
相关资源
最近更新 更多