简体   繁体   English

GWT / Maven项目-Maven依赖顺序错误

[英]GWT/Maven Project - Maven dependency order wrong

I use the HtmlUnit (Particular the WebClient class) library in my GWT/Maven App. 我在GWT / Maven应用程序中使用HtmlUnit(特别是WebClient类)库。 But for some reason there seems to be a very old version in the GWT Jar, which is used. 但是由于某种原因,似乎在使用的GWT Jar中有一个非常旧的版本。 Under "Java Build Path" in the "Order and Export" Tab, i moved my "Maven Dependencies" to the top. 在“订单和导出”选项卡的“ Java构建路径”下,我将“ Maven依赖关系”移动到了顶部。 So it should look for the sources here first, right? 因此,它应该首先在这里寻找资源,对吗?

Why is then always the old version from the GWT Jar used? 那么为什么总是使用GWT Jar中的旧版本? How can I prevent that? 我该如何预防?

It the pom.xml it only is shown once: 仅显示pom.xml一次: 在此处输入图片说明

The two classes: 这两个类: 在此处输入图片说明

GWT uses HtmlUnit for GWTTestCase s, and will only be modularized (with declared/managed dependencies) in GWT 3.0 scheduled for Google I/O 2014. GWT将HtmlUnit用于GWTTestCase ,并且只会在计划用于Google I / O 2014的GWT 3.0中进行模块化(具有声明的/托管的依赖项)。

Maven does not support arbitrary classpaths (only compile, test and runtime), so you have no other choice than moving your use of HtmlUnit into another Maven module that wouldn't depend on GWT. Maven不支持任意的类路径(仅编译,测试和运行时),因此除了将HtmlUnit的使用转移到另一个不依赖GWT的Maven模块之外,您别无选择。

Note that even if GWT were using managed dependencies, it wouldn't solve your problem: GWTTestCase would then break, because the versionyou use (HtmlUnit 2.13) is not backwards compatible with the on bundled in GWT 2.5.1 (HtmlUnit 2.9). 请注意,即使GWT使用的是托管依赖项,也无法解决您的问题: GWTTestCase会中断,因为您使用的版本(HtmlUnit 2.13)与GWT 2.5.1(HtmlUnit 2.9)捆绑的版本不向后兼容。
…or as Colin suggested, try GWT 2.6.0-rc1 which uses (bundles) HtmlUnit 2.13. …或按照Colin的建议,尝试使用(捆绑)HtmlUnit 2.13的GWT 2.6.0-rc1。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM