Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Groovy 2: Cant find JSonSlurper and XmlSlurper anymore

Tags:

groovy

I upgraded to groovy 2 release and now my build is broken.

It fails when importing classes: groovy.json.JsonSlurper and XmlSlurper.

I have checked http://groovy.codehaus.org/gapi/ and cannot find these classes anymore. Do they still exist in groovy 2? Or have they moved somewhere?

like image 278
Steven Avatar asked Jun 28 '12 12:06

Steven


2 Answers

The groovy.jar distributed with groovy 2 has been split out to contain just the bare minimum, with all the additional modules (XML, SQL, JSON, etc.) in separate jars. However, in the embeddable directory, you'll find a jar file groovy-all-2.0.0.jar which contains groovy and all the modules together, like previous versions. The easiest way to migrate is to use this jar file.

If you're using Maven Central, you can use an artifactId of groovy-all to get everything, or groovy (plus modules) to have finer grained control over your dependencies. Here's a list of the modules available on Maven Central: http://search.maven.org/#search|ga|1|g%3A%22org.codehaus.groovy%22

like image 158
ataylor Avatar answered Oct 07 '22 21:10

ataylor


Never mind. Need to include groovy-xml and groovy-json jars. These were split from groovy's jar. See: http://www.infoq.com/articles/new-groovy-20

like image 24
Steven Avatar answered Oct 07 '22 21:10

Steven