Search code examples
groovygeb

Geb-core 3.2 conflict with groovy 2.5.8


I try use last groovy 2.5.8 with geb-core 3.2.

E.g.

@Grapes([
        @Grab("org.gebish:geb-core:3.2"),
        @Grab("org.seleniumhq.selenium:selenium-firefox-driver:3.141.59"),
        @Grab("org.seleniumhq.selenium:selenium-support:3.141.59")
])
import geb.Browser
browser = new Browser()
println "Hello from test"

It is generate error

C:\PROJ\bitb\checkBoard\test>groovy runTest.groovy org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: General error during conversion: Conflicting module versions. Module [groovy-xml is loaded in version 2.5.8 and you are trying to load version 2.5.6

If I change geb-core to 2.3.1 it work well. Maybe I should change something configs?

Thanks in advance!


Solution

  • Geb has a dependency on Groovy but you already have Groovy loaded when running the script - you need to grab exclude Groovy modules:

    @Grapes([
            @Grab("org.gebish:geb-core:3.2"),
            @Grab("org.seleniumhq.selenium:selenium-firefox-driver:3.141.59"),
            @Grab("org.seleniumhq.selenium:selenium-support:3.141.59"),
            @GrabExclude("org.codehaus.groovy:groovy-all")
    ])