Search code examples
intellij-ideagroovyratpack

Groovy conflicting in Intellij


I have a groovy project in Intelij, when I try build my project using gradle I get this message about conflicting groovy versions.

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

I go into project settings then remove groovy 2.5 from my project libraries, this works until I run my build script again and it loads 2.3 for my normal groovy and 2.5 for my groovy tests.

Below is my gradle script, is there a way of just loading one version of groovy for both test and normal purposes.

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

Solution

  • You need to exclude groovy from the Spock dependency

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

    You can always find what is pulling in an errant dependency, by using

    gradle dependencies
    

    And looking through the output