Here is simple request I try to do and watch response
def httpReq = new HTTPBuilder("http://${url}")
httpReq.request(Method.GET, ContentType.JSON) {
response.success = { resp ->
println("Ok " + resp.status.toString())
}
response.failure = { resp ->
println("Not ok" + resp.status.toString())
}
This returns an Error:
java.lang.ClassNotFoundException: org.apache.commons.collections.iterators.ArrayIterator
I think that ArrayIterator defined in jdk. I added manually org.apache.commons:commons-collections4:4.4 but it doesn't help.
TL;DR
Don't waste your time by gathering deps. Use a build tool like Gradle or Maven - or use Groovys Grapes if only a script is needed and Groovy is installed (or easily installable) on your target.
Using
grapeYou have to pick up all the transitive dependencies (this means the correct packages with the correct versions). E.g. with
@Grab:If you really want to gather all the deps manually
grapecan also help. It can tell you, what jars are needed:From this list you can build up your own classpath to pass to groovy and work without grape. E.g.: