3

In my POM, there is a dependency: spock-core 1.0-groovy-2.3, which adds groovy-all 2.3.10 to my project. And, my eclipse groovy plugin contains groovy-all 2.3.7 jar. So, whenever I try to run my groovy spec file, following error is thrown:

groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-all is loaded in version 2.3.7 and you are trying to load version 2.3.10

So, inorder to match the jars I am left with two options:

  • Downgrade the version of spock-core dependency
  • Upgrade eclipse plugin groovy-all jar to 2.3.10

First option is NOT possible as there is no such spock-core dependency which could provide me groovy-all 2.3.7 jar. So, please guide me as how I should upgrade my groovy eclipse plugin from 2.3.7 to 2.3.10.

P.S. I have set groovy compiler level as 2.3 for my project. And, I am facing the same issue on Luna, Kepler, Juno eclipse.

Swati Khandelwal
  • 195
  • 2
  • 2
  • 14
  • Related (but not duplicate) https://stackoverflow.com/questions/15079286/grails-groovy-ggts-conflicting-module-versions-on-run-app/32672393#32672393 – Joshua Goldberg Sep 19 '15 at 19:35
  • Does your Eclipse project contain a Groovy Libraries classpath container (the source of the eclipse plugin groovy-all jar)? This can be removed from your project if the Maven Dependencies container is where you are getting groovy-all and spock-core. – emilles Mar 12 '20 at 03:14

2 Answers2

5

You can "downgrade" the Spock dependency. Simply add an exclude of "groovy-all" to your Spock dependency. Then explicitly add a dependency on groovy-all 2.3.7

The exclusion can be added as follows:

<dependency>
    ...
    <exclusions>
        <exclusion>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
        </exclusion>
    </exclusions>
    ...
</dependency>
Community
  • 1
  • 1
radix
  • 51
  • 1
0

Update your POM file by adding the below maven repos:

<!-- Below 3 GROOVY dependencies are MUST to waive the version conflict in runtime
         https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-all -->
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>2.4.16</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-xml -->
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-xml</artifactId>
            <version>2.4.16</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy -->
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy</artifactId>
            <version>2.4.16</version>
        </dependency>
סטנלי גרונן
  • 2,917
  • 23
  • 46
  • 68
Yasin Bekar
  • 127
  • 1
  • 4
  • See the required version appears on the console. Then search on google about these versions on mvn repo. My case was 2.4.16 was the conflict and added these versions manually. Issue RESOLVED! – Yasin Bekar Jan 29 '20 at 15:48