grailsgroovyintellij-ideageb

"Exception in thread "main" java.lang.ClassNotFoundException: org.codehaus.groovy.tools.GroovyStarter" error while running a simple GEB program


I have:

and all the required jars.

I am trying to run a simple GEB program:

@Grapes([
    @Grab("org.codehaus.geb:geb-core:0.7.2"),    
    @Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.28.0"),
    @Grab("org.seleniumhq.selenium:selenium-support:2.15.0")
])
import geb.Browser

Browser.drive {
    go "http://googel.com/"
    assert title == "Google"
}

and as I run this I am seeing the above mentioned exception:

Exception in thread "main" java.lang.ClassNotFoundException: org.codehaus.groovy.tools.GroovyStarter
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)

Solution

  • It has nothing to do with Geb -- your environment is misconfigured.

    Have a look at this groovy user mailing list thread.

    Another thing is that as far as I know Geb 0.7.2 is compiled with Groovy 1.8.6 and I don't know if it's compatible with Groovy 2.0.