Swati Khandelwal
Swati Khandelwal

Reputation: 195

Compatibility issue between the 'groovy-all' jars present in eclipse plugin and maven dependency

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:

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.

Upvotes: 3

Views: 10351

Answers (2)

Yasin Bekar
Yasin Bekar

Reputation: 147

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>

Upvotes: 0

radix
radix

Reputation: 51

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>

Upvotes: 5

Related Questions