如何导入 groovyx.net.http

发布于 2024-11-18 12:05:20 字数 477 浏览 3 评论 0 原文

我不明白 Maven 或 Grape,而且我是个白痴,所以如果你的答案是“先去 grap X-dependency manager,然后 rtfm,你就设置好了”,请给我一步一步的信息。我在哪里找到并转储文件以使该行工作:

import groovyx.net.http.HTTPBuilder

它说 Groovy: 无法解析类 groovyx.net.http.HTTPBuilder

另外,我无法导入 groovyx.net.http。 ContentType.URLENC 它说无法解析类groovyx.net.http.ContentType.URLENC

更新:

显然你可以取消注释行mavenRepo BuildConfig.groovy 中的“http://repository.codehaus.org”

I don't understand maven or grape, and I'm an idiot so give me the step by step if your answer is "go grap X-dependency manager and then rtfm and you're set." Where do i find and dump files to make this line work:

import groovyx.net.http.HTTPBuilder

It says Groovy: unable to resolve class groovyx.net.http.HTTPBuilder

Also I am unable to import groovyx.net.http.ContentType.URLENC It says unable to resolve class groovyx.net.http.ContentType.URLENC

Update:

apparently you can uncomment the line mavenRepo "http://repository.codehaus.org" in BuildConfig.groovy

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

叫思念不要吵 2024-11-25 12:05:20

既然您正在谈论 BuildConfig.groovy,我假设问题的目标是在 grails 应用程序中使用 HttpBuilder。如果是这样,您可以

compile('org.codehaus.groovy.modules.http-builder:http-builder:0.5.0') {
        excludes "commons-logging", "xml-apis", "groovy"
}

在 BuildConfig.groovy 的依赖项部分中使用,或者更简单,只需安装 休息插件

grails install-plugin rest

Since you're talking about BuildConfig.groovy I assume the question is targeted at using HttpBuilder in a grails application. If so, you could either use

compile('org.codehaus.groovy.modules.http-builder:http-builder:0.5.0') {
        excludes "commons-logging", "xml-apis", "groovy"
}

in the dependencies-section of BuildConfig.groovy, or, even more easier, just install the rest plugin:

grails install-plugin rest
止于盛夏 2024-11-25 12:05:20

Thom Nichols 实际上在 http://groovy.329449.n5.nabble.com/problem-running-http-builder-code-td3995735.html 类似的问题。

基本上,您可以进入 http://snapshots.repository.codehaus.org/org/codehaus/groovy/modules/http-builder/http-builder/ 并下载以结尾的软件包之一 '全部'。在其中,您将找到一个依赖项目录,其中包含您需要的所有依赖项,您可以将其放置在 lib 目录中。所有 zip(或 tar)文件的根目录应包含主 http-builder-#.#-SNAPSHOT.jar,您还应将其放置在 lib 中。

我只是从 Groovy 控制台执行此操作。对于 Grails,我想 Stefan 的回答是安装 Grails 休息插件是最好的选择。

Thom Nichols actually provided a helpful answer at http://groovy.329449.n5.nabble.com/problem-running-http-builder-code-td3995735.html to a similar question.

Basically, you can get into one of the snapshot directories at http://snapshots.repository.codehaus.org/org/codehaus/groovy/modules/http-builder/http-builder/ and download one of the packages ending with 'all'. Inside there, you'll find a dependencies directory that contains all the dependencies you need, which you can place in your lib directory. The root of the all zip (or tar) file should contain the main http-builder-#.#-SNAPSHOT.jar, which you should also place in lib.

I was doing this just from the Groovy Console. For Grails, I imagine Stefan's answer of just installing the Grails rest plugin is the best bet.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文