I am trying to use groovy's HTTPBuilder. I'm getting:
groovy.lang.MissingMethodException: No signature of method: groovyx.net.http.HTTPBuilder.get() is applicable for argument types: (groovyx.net.http.Method, groovyx.net.http.ContentType, com.company.sample.mypackage.myClient$_foo_closure1) values: [GET, application/json, com.company.sample.mypackage.myClient$_foo_closure1@7ee6e5bc] Possible solutions: grep(), get(java.util.Map), get(java.util.Map, groovy.lang.Closure), wait(), getUri(), any()
I think I'm using something almost exactly like the example on HTTPBuilder's documentation. I'm wondering if my problem is environmental with how I have my project set up in Intellij? It's the first time I've set up a maven project in intellij on my own so I'm suspicious.
package com.company.sample.mypackage
import groovyx.net.http.HTTPBuilder
import static groovyx.net.http.Method.GET
import static groovyx.net.http.ContentType.JSON
public class myClient {
public static void main(String[] args) {
foo();
}
public static void foo() {
def http = new HTTPBuilder( 'http://foo.com' )
http.get(GET, JSON) { <---EXCEPTION HAPPENS HERE
uri.path = '/api/myapi'
response.success = { resp, json ->
println 'Successful'
}
response.failure = { resp ->
println 'failure'
}
}
}
}
Also note: I'm using java 1.7, groovy 2.4.3 and http-builder 0.6...in case that's part of the problem.