使用 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);
}
我在主题标题中收到错误。我在这里想念什么?
最佳答案
一个比较通用的步骤,用于检查缺少插件的问题
"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/