How to import groovyx.net.http

30,556

Solution 1

Since you're talking about BuildConfig.groovy I assume the question is targeted at using HttpBuilder in a grails application. If so, you could either use

compile('org.codehaus.groovy.modules.http-builder:http-builder:0.5.0') {
        excludes "commons-logging", "xml-apis", "groovy"
}

in the dependencies-section of BuildConfig.groovy, or, even more easier, just install the rest plugin:

grails install-plugin rest

Solution 2

try importing the .jar for HTTPBuilder-http://repository.codehaus.org/org/codehaus/groovy/modules/http-builder/http-builder/0.5.2/

Share:
30,556

Related videos on Youtube

Mikey
Author by

Mikey

I am learning Grails. It is awesome.

Updated on July 09, 2022

Comments

  • Mikey
    Mikey almost 2 years

    I don't understand maven or grape, and I'm an idiot so give me the step by step if your answer is "go grap X-dependency manager and then rtfm and you're set." Where do i find and dump files to make this line work:

    import groovyx.net.http.HTTPBuilder
    

    It says Groovy: unable to resolve class groovyx.net.http.HTTPBuilder

    Also I am unable to import groovyx.net.http.ContentType.URLENC It says unable to resolve class groovyx.net.http.ContentType.URLENC

    Update:

    apparently you can uncomment the line mavenRepo "http://repository.codehaus.org" in BuildConfig.groovy

  • Mikey
    Mikey almost 13 years
    I'm accepting this, but I think I had already installed rest prior to asking my question. Not sure. Also I don't understand your answer. I fixed my problem by uncommenting the line I said at the end of my question. Thanks for help, though.
  • Mark K Cowan
    Mark K Cowan almost 10 years
    Note that "install-plugin" doesn't seem to work anymore. God I miss node and npm so much since starting a Grails project...
  • Andrew Drake
    Andrew Drake about 6 years
    link is outdated