Gradle is unable to resolve class groovy.util.XmlSlurper

I have set up a very simple (not to say trivial) groovy project. When i try to build with gradle, gradle complains it is unable to resolve classes from the groovy.util package.

These are my dependencies in build.gradle:

dependencies {

groovy group: ‘org.codehaus.groovy’, name: ‘groovy’, version: ‘2.0.1’

testCompile group: ‘org.codehaus.groovy’, name: ‘groovy’, version: ‘2.0.1’ }

I’m lost. Please help

Hey Peter, I trink the groovy 2.0.1 distribution is modularized more than the former groovy versions. you can either use “org.codehaus.groovy:groovy-all:2.0.1” or add “org.codehaus.groovy:groovy-xml:2.0.1” to your existing build

cheers, René

In addition to René’s comment, not that you don’t need to explicitly add it to the ‘testCompile’ configuration as this configuration inherits from the ‘groovy’ configuration.

Thanks a lot guys, that helped.

Maybe the user guide should be updated? By adding an dependency example for groovy 2.x? http://gradle.org/docs/current/userguide/tutorial_groovy_projects.html#N106C9

Regards Peter

Documentation patches are always welcome :).

I’m confused. How did you add the dependency to gradle instead of the build which gradle performs?

I don’t understand the (context of the) question. Please start a new topic.