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

Unable to Build #6

Open cjstehno opened 6 years ago

cjstehno commented 6 years ago

I've encountered a similar issue and am including the output of a run with stacktrace and debug flags enabled in hopes that it's helpful:

output.txt

Here is the task I attempted to configure:

task refreshPlugins(type:HttpTask) {
    config {
        request.uri = 'https://artifactory.test.net/artifactory'
    }
    post {
        request.uri.path = '/api/plugins/reload'
        response.success {
            lifecycle.info 'Plugins reloaded on test instance.'
        }
    }
}

and my plugins block:

plugins {
  id 'groovy'
  id 'org.hidetake.ssh' version '2.9.0'
  id 'io.github.http-builder-ng.http-plugin' version '0.1.1'
}
cjstehno commented 6 years ago

@PFacheris - that other issue was spam, let's use this one for this problem.

I don't see any error or warning log messages in the log... what behavior are you seeing? HTTPS can be a bit finicky. Can you try using ignoreSslIssues as a test to see if it's related to that?

PFacheris commented 6 years ago

Oops, sorry about that. Missed an ampersand in my redirect of stderr to stdout, this should have the error output as well: output_new.txt

Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'HttpTask' for root project 'artifactory-plugin-unique-virtual-repo-deploy' of type org.gradle.api.Project.
  at org.gradle.internal.metaobject.AbstractDynamicObject.getMissingProperty(AbstractDynamicObject.java:83)
  at org.gradle.groovy.scripts.BasicScript$ScriptDynamicObject.getMissingProperty(BasicScript.java:156)
  at org.gradle.internal.metaobject.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:61)
  at org.gradle.groovy.scripts.BasicScript.getProperty(BasicScript.java:65)
  at build_3xqfywx4e65rqohu0iyuq09q1.run(/home/pfacheris/git-repos/internal-pkg/artifactory-plugin-unique-virtual-repo-deploy/build.gradle:52)
  at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:90)
  ... 93 more
hauva007 commented 6 years ago

I have same problem here. Any advice on this?

cjstehno commented 6 years ago

What version of Grade are you using, and what version of Java?

mricciuti commented 6 years ago

Hi. I found out that we need to provide the full qualified name of the HttpTask as follows:

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

Maybe an extension "HttpTask" should be created by this plugin, referencing HttpTask.class, so that we can use task xx(type: HttpTask) {...} directly?

note: I use Gradle 4.9 with JDK8

cjstehno commented 6 years ago

If that's the case, an import should also work, which is pretty standard in Gradle build files.

I will leave this issue open and add some notes related to it in the documentation with the next release.

Thanks for digging into it.