http-builder-ng / gradle-http-plugin

Gradle plugin providing support for using HttpBuilder-NG to make HTTP requests as Gradle Tasks.
https://http-builder-ng.github.io/gradle-http-plugin/
Apache License 2.0
31 stars 8 forks source link

Could not get unknown property 'HttpTask' #8

Closed clwillingham closed 6 years ago

clwillingham commented 6 years ago

trying to add HttpTask to ftc_app android app: https://github.com/ftctechnh/ftc_app in the root build.gradle I changed it to:

buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath "gradle.plugin.io.github.http-builder-ng:http-plugin:0.1.1"
    }
}

in build.common.gradle, I changed the top to of the file to the following:

import java.util.regex.Pattern

apply plugin: 'com.android.application'
apply plugin: "io.github.http-builder-ng.http-plugin"

http {
    library = 'apache'
    config {
        request.uri = 'http://localhost:1234'
    }
}

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'
        }
    }
}

when I sync the project, triggering a gradle build I receive the following error:

Could not get unknown property 'HttpTask' for project ':TeamCode' of type org.gradle.api.Project.
clwillingham commented 6 years ago

Solved, forgot to import import io.github.httpbuilderng.http.HttpTask