如何覆盖maven-core-2.0.7-uber.jar? [英] How to override maven-core-2.0.7-uber.jar?
问题描述
我的问题是我正在尝试将特定的JTidy版本与maven(v8.0或更高版本)一起使用.一切在编译时都可以正常工作,但是在运行时,maven在maven-core-2.0.7-uber.jar
中使用其自己的实现覆盖了pom.xml中的JTidy.
My problem is that I am trying to use a specific JTidy version with maven (v8.0 or something). Everything works fine during compile time, but at runtime maven overrides the JTidy in the pom.xml with its own implementation in maven-core-2.0.7-uber.jar
.
另请参见上一个问题.
该怎么办?我的应用程序编译良好,但在运行时失败,因为类加载器从maven-core-2.0.7-uber.jar
而不是pom.xml
中给定的文件加载文件.有什么方法可以在运行时或最好在编译时强制使用它吗?
What can be done? My application compiles fine but fails at runtime because the classloader loads the file from maven-core-2.0.7-uber.jar
instead of the one given in pom.xml
. Is there some way to force it at runtime or preferably at compile time?
推荐答案
在<dependencyManagement>
元素中设置正确的版本应覆盖默认值.
Setting the correct version in a <dependencyManagement>
element should override the default.
一种解决方法是用所需版本替换maven存储库本地副本中的JTidy JAR.
A workaround is to replace the JTidy JAR in your local copy of the maven repository with the version you want.
我还建议尝试使用Maven 2.2.他们更改了工件查找规则,这可能会解决您的问题.并查看有效的POM(mvn help:effective-pom
),以了解哪些规则适用于插件查找.
I also suggest to try Maven 2.2. They changed the artifact lookup rules, that might fix your issue. And have a look at the effective POM (mvn help:effective-pom
) to see which rules apply for plugin lookup.
这篇关于如何覆盖maven-core-2.0.7-uber.jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!