Gradle is unable to resolve class groovy.util.XmlSlurper

(Peter Doornbosch) #1

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

(René Groeschke) #2

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é

(Luke Daley) #3

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.

(Peter Doornbosch) #4

Thanks a lot guys, that helped.

Maybe the user guide should be updated? By adding an dependency example for groovy 2.x?

Regards Peter


Documentation patches are always welcome :).

(Peter Kahn) #6

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

(Peter Niederwieser) #7

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