Search code examples
groovygeb

geb using grapes - download failed: commons-codec#commons-codec;1.6!commons-codec.jar


I'm trying to run geb using the grab examples in the user guide for pulling in dependencies:

$ cat my.groovy
@Grapes([
    @Grab("org.gebish:geb-core:0.9.2"),
    @Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.26.0"),
    @Grab("org.seleniumhq.selenium:selenium-support:2.26.0")
])
import geb.Browser

Browser.drive{
    go "http://grails.org/plugins/"

}

However, the above code results in:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during conversion: Error grabbing Grapes -- [download failed: commons-codec#commons-codec;1.6!commons-codec.jar]

java.lang.RuntimeException: Error grabbing Grapes -- [download failed: commons-codec#commons-codec;1.6!commons-codec.jar]

Any help will be appreciated.


Solution

  • It's trying to get an old version of that Codec... just force a newer one by adding an explicit annotation. I also updated the selenium dependency versions to run against my latest n greatest FireFox, v 29.0 at the time of this writing:

    @Grapes([
        @Grab("org.gebish:geb-core:0.9.2"),
        @Grab(group='commons-codec', module='commons-codec', version='1.9'),
        @Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.41.0"),
        @Grab("org.seleniumhq.selenium:selenium-support:2.41.0")
    ])
    

    And of course make sure you have FireFox installed on your machine.