grails - 无法解析AsyncHttpBuilder类

标签 grails groovy

使用 Grails 1.3.9

buildConfig.groovy

compile "org.grails.plugins:async-http-builder"

码:
    AsyncHttpBuilder client = new AsyncHttpBuilder()
    Promise<HttpClientResponse> p = client.post("http://someuUrl") {
        contentType 'application/json'
        json {
            receiver number
            message content
            sender sender
        }
    }
    p.onComplete { HttpClientResponse resp ->
        println(resp);
    }

我在主题标题中收到错误。我在这里想念什么?

最佳答案

一个比较通用的步骤,用于检查缺少插件的问题

  • 检查BuildConfig.groovy
  • "https://repo.grails.org/grails/plugins"中是否有mavenRepo repositories {
  • 提供插件版本,因此请代替"org.grails.plugins:async-http-builder"尝试"org.grails.plugins:async-http-builder:1.0.0"
  • 在终端
  • 中尝试grails refresh-dependencies
    查看提交日期,它看起来像一个新的插件(不到1年),因此它可能仅适用于较新的Grails版本(2 + / 3 +)。

    documentation状态

    Note that this client does not require Grails itself, and can easily be used standalone or as an independent HTTP client. (...)

    To get started with the HTTP client you should declare a dependency on the grails-http-client project in your build.gradle file:

    compile "org.grails:http-client:VERSION"



    因此,我可能会尝试一下,因为该插件可能无法在您的旧Grails版本上正常运行。

    关于grails - 无法解析AsyncHttpBuilder类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42552055/

    相关文章:

    java - 如何在隔离的类加载器中执行 groovy 脚本?

    grails - 在 Bootstrap 中使用 groovy 元类模拟 Shiro SecurityUtils

    java - rx java observable 仅在匹配的 observable 上链接

    javascript - 我如何从 JavaScript 和 Grails 访问变量?

    grails - 将Javascript变量传递到taglib方法调用Grails中

    hibernate - 不使用 Grails 查询缓存

    grails - Grails:如何从命令行脚本访问应用程序配置?

    chalice : Difference between\${} and ${}

    java - Grails:JAVA_HOME 未正确定义

    shell - 执行shell时Jenkins管道 "java.io.NotSerializableException: hudson.model.User"