XUtils

HTTP Builder NG Gradle Plugin

Gradle plugin providing HTTP Builder NG support in a Gradle build configuration.


Introduction

A Gradle plugin providing the ability to define tasks to make HTTP requests using the HttpBuilder-NG client library. The resulting tasks have a clean DSL and will look something like the following:

Groovy

task notify(type:HttpTask){
    config {
        request.uri = 'http://something.com'
    }
    post {
        request.uri.path = '/notify'
        request.body = [event: 'activated']
        response.success {
            println 'The event notification was successful'
        }
    }
}

Kotlin

tasks {
    val notify by registering(HttpTask::class) {
        config {
            it.request.setUri = "http://something.com"
        }
        post {
            it.request.uri.setPath("/notify")
        }
        response.success { fromServer, body ->
            println("The event notification was successful")
        }
    }
}

Installing

The plugin is available through the Gradle Plugin Repository and may be applied to your Gradle build with one of the following:

plugins {
  id "io.github.http-builder-ng.http-plugin" version "0.1.1"
}

or

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.io.github.http-builder-ng:http-plugin:0.1.1"
  }
}

apply plugin: "io.github.http-builder-ng.http-plugin"

Building

The project is build with Gradle using the following command:

./gradlew clean build

Articles

  • coming soon...