Unable to resolve class HTTPBuilder

Hello,

I’m just getting started/learning Gradle. I’m trying to use HTTPBuilder in my script. Haven’t put any functionalities yet but I’m already running into some roadblocks.

Here’s what I have on my build.gradle script file:

apply plugin: 'java'
apply plugin: 'groovy'
  buildscript {
 repositories {
  mavenCentral()
 }
    dependencies {
  classpath group: 'org.codehaus.groovy.modules.http-builder', name: 'http-builder', version: '0.7.1'
 }
}
  // initialze a new builder and give a default URL
def http = new HTTPBuilder('http://www.google.com/search')

I’m getting the error on last line saying "Unable to resolve class HTTPBuilder. What have I missed in the above script?

You’re missing an import statement.

import groovyx.net.http.HTTPBuilder

Any class that is not part of the Gradle API will need to be explicitly imported to be referenced in your build script.

Thank you Mark for your reply. That’s exactly what I was missing.