title: How to use HTTP builder within Jenkins
body: <p>I am trying to use <a href="https://github.com/jgritman/httpbuilder/wiki/POST-Examples" rel="nofollow noreferrer">HTTP Builder</a> to make a POST request in a pipeline script, (do have it in a shared lib where it works via the command line) but need it to work in Jenkins</p>
  
  <p>I am getting the following error when running in Jenkins. </p>
  
  <pre><code>No suitable ClassLoader found for grab
  </code></pre>
  
  <p>My script looks as follows</p>
  
  <pre><code>@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7')
  
  import static groovyx.net.http.ContentType.JSON
  import static groovyx.net.http.Method.POST
  import groovyx.net.http.HTTPBuilder
  
  def gitUpdateStatus() {
    String targetUrl = 'https://api.github.com/repos/myOrg/'
    def http = new HTTPBuilder(targetUrl)
    http.request(POST) {
    uri.path = "myRepo/statuses/commit_id_here"
    requestContentType = JSON
    body = [state: 'failure', description: 'Jenkins Unit Tests', target_url: 'http://test.co.uk', context: 'unit tests']
    headers.'Authorization' = "token 123"
    headers.'User-Agent' = 'Jenkins Status Update'
    headers.Accept = 'application/json'
  
    response.success = { resp, json -&gt;
      println "GitHub updated successfully! ${resp.status}"
    }
  
    response.failure = { resp, json -&gt;
      println "GitHub update Failure! ${resp.status} " + json.message
    }
  }
  
  node {
  
    stage('Echo Client JS')
      git branch: 'master', credentialsId: '${JENKINS_CREDENTIALS_ID}', url: 'git@github.com:myOrg/myRepo.git'
      gitUpdateStatus()
  
  }
  </code></pre>
  
  <p>I have seen many posts where the same issue has arisen but I just cannot seem to figure out how this has been fixed, can anyone assist please ?</p>
  
  <p>Thank You</p>