groovy - No signature of method: groovyx.net.http.HTTPBuilder.get() in intellij -


i trying use groovy's httpbuilder. i'm getting:

groovy.lang.missingmethodexception: no signature of method: groovyx.net.http.httpbuilder.get() applicable 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 example on httpbuilder's documentation. i'm wondering if problem environmental how have project set in intellij? it's first time i've set maven project in intellij on own 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 , http-builder 0.6...in case that's part of problem.

you should invoke request not get

public static void foo() {      def http = new httpbuilder( 'http://foo.com' )     http.request(get, json) {          uri.path = '/api/myapi'          response.success = { resp, json ->             println 'successful'         }         response.failure = { resp ->             println 'failure'         }     } } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -