如何从 grails 的类路径中获取 4.0 版本的 httpclient
我正在使用 Grails 1.3.7,无法弄清楚如何从我的类路径中获取 httpclient 4.0 版本(支持 4.1)。我需要这样做是因为该插件依赖于 4.1 中使用的无参数构造函数。
运行 grails 'dependency-report',看起来 4.1 应该是运行时使用的版本。如果我把东西打包成一个 .war ,那就是这样。然而,由于某种原因,当使用 run-app 时,4.0 版本仍然最终出现在类路径上。请注意,它(正确地)在编译时用于某些 grails 内部结构,并且不知何故它仍然出现在我的类路径中。
->我能否弄清楚 4.0 .jar 到底来自哪里并最终出现在我的类路径上并阻止它发生(通过 run-app 运行时所有 .jar 放在哪里?)
->我可以告诉 grails 使用 4.1 而不是 4.0 进行内部编译(在本例中是 org.codehaus.groovy.modules.http-builder 模块的 http-builder 吗?)可以说不是最好的解决方案,但我会接受它,因为每次我想测试它时,将所有内容都打包到 .war 中并不令人愉快。
帮助将不胜感激。
I am using Grails 1.3.7 and cannot figure out how to get version 4.0 of httpclient off of my classpath (in favour of 4.1). I need to do this because of a no-args constructer used in 4.1 that the plugin relies on.
Running a grails 'dependency-report', it appears that 4.1 should be the one being used at runtime. And it IS, if I package things up into a .war. HOWEVER version 4.0 is still ending up on the classpath when using run-app for some reason. Note it is (correctly) being used at compile time for some grails internals, and somehow it is still ending up on my classpath.
-> Can I figure out where exactly that 4.0 .jar is coming from and ending up on my classpath and stop it from happening (where are all the .jars put when running via run-app?)
-> Can I tell grails to compile with 4.1 instead of 4.0 for its internals (in this case the http-builder by org.codehaus.groovy.modules.http-builder module?) Arguable not the best solution but I'll take it, as packaging everything into a .war every time I want to test it is not pleasant.
Help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚经历了同样的事情,将以下内容添加到您的 BuildConfig.groovy
干杯
Lee
I just went through the same thing, add the following to your BuildConfig.groovy
cheers
Lee
您可以通过在
BuildConfig.groovy
中添加排除行来从类路径中获取 httpclient 4.0。使用 grails dependency-report 命令找出哪个插件将其声明为依赖项。一旦找到哪个包含它,您可以将其排除在
BuildConfig.groovy
的插件部分中。例子:依赖 httpclient 4.1 中无参数构造函数的插件应将其声明为依赖项。如果没有,您应该向插件作者提出问题。要解决此问题,您可以按照上面 leebutts 的描述在依赖项部分中列出 httpclient 4.1。
You can get httpclient 4.0 off of the classpath by adding an excludes line in
BuildConfig.groovy
. Figure out which plugin is declaring it as a dependency by using thegrails dependency-report
command.Once you find which one included it, you can exclude it in the plugins section of
BuildConfig.groovy
. Example:The plugin that relies on the no-arg constructor in httpclient 4.1 should declare it as a dependency. If it does not you should open an issue with the author of the plugin. To workaround this, you can list httpclient 4.1 in the dependencies section as leebutts describes above.