tags:

views:

159

answers:

1

hi i tried import groovyx.net.ws.WSClient from both groovysh or groovyConsole, adn netbeans ...

it just says "cannot resolve class groovyx.net.ws.WSClient"

any body gives me an hint?

thanks!

A: 

The Groovy WSClient is not part of the core groovy distribution. It is actually a separate standalone library. You need to download it separately and put it on your classpath or use the Grab annotation to download it at runtime.

Example:

@Grab(group='org.codehaus.groovy.modules', module='groovyws', version='0.5.1')
import groovyx.net.ws.WSClient

Note that this was done with Groovy 1.7.2. Previous to 1.7 @Grab was not available on imports. If you are using an older version, put the @Grab on a method.

Chris Dail
Thank you, Chris! It really helps - I spent hours googling an answer....seems 2 hours googling is not worthy 5 minutes stackoverflowing!
john