java – 使用xml-apis混淆传递依赖行为
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了java – 使用xml-apis混淆传递依赖行为,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含5823字,纯文字阅读大概需要9分钟。
内容图文
![java – 使用xml-apis混淆传递依赖行为](/upload/InfoBanner/zyjiaocheng/787/3f79ce7b83654f39af587cf97bd9667b.jpg)
在我的项目中,我依赖于几个依赖于各种版本的xml-apis的外部库.如果我使用maven-enforcer-plugin to fail if there are version conflicts我的构建失败.
在开始之前,打印正在运行的应用程序的类路径给出了xml-apis:xml-apis:1.4.01
当我启用maven-enforcer-plugin时,我得到了这个,这是预期的
Dependency convergence error for xml-apis:xml-apis:1.3.04 paths to dependency are:
+-org.bbraile:bbraile:1.0-SNAPSHOT
+-org.bbraile:utd:1.0-SNAPSHOT
+-xalan:xalan:2.7.2
+-xalan:serializer:2.7.2
+-xml-apis:xml-apis:1.3.04
and
+-org.bbraile:bbraile:1.0-SNAPSHOT
+-org.bbraile:utd:1.0-SNAPSHOT
+-xml-apis:xml-apis:1.4.01
and
+-org.bbraile:bbraile:1.0-SNAPSHOT
+-org.bbraile:utd:1.0-SNAPSHOT
+-xerces:xercesImpl:2.11.0
+-xml-apis:xml-apis:1.4.01
and
+-org.bbraile:bbraile:1.0-SNAPSHOT
+-com.io7m.xom:xom:1.2.10
+-xml-apis:xml-apis:1.3.03
and
+-org.bbraile:bbraile:1.0-SNAPSHOT
+-org.apache.xmlgraphics:batik-transcoder:1.7
+-org.apache.xmlgraphics:batik-bridge:1.7
+-org.apache.xmlgraphics:batik-anim:1.7
+-xml-apis:xml-apis:1.3.04
and
+-org.bbraile:bbraile:1.0-SNAPSHOT
+-org.apache.xmlgraphics:batik-transcoder:1.7
+-org.apache.xmlgraphics:batik-bridge:1.7
+-org.apache.xmlgraphics:batik-css:1.7
+-xml-apis:xml-apis:1.3.04
and
+-org.bbraile:bbraile:1.0-SNAPSHOT
+-org.apache.xmlgraphics:batik-transcoder:1.7
+-org.apache.xmlgraphics:batik-bridge:1.7
+-org.apache.xmlgraphics:batik-ext:1.7
+-xml-apis:xml-apis:1.3.04
and
+-org.bbraile:bbraile:1.0-SNAPSHOT
+-org.apache.xmlgraphics:batik-transcoder:1.7
+-org.apache.xmlgraphics:batik-bridge:1.7
+-xml-apis:xml-apis:1.3.04
and
+-org.bbraile:bbraile:1.0-SNAPSHOT
+-org.apache.xmlgraphics:batik-transcoder:1.7
+-org.apache.xmlgraphics:batik-dom:1.7
+-xml-apis:xml-apis:1.3.04
and
+-org.bbraile:bbraile:1.0-SNAPSHOT
+-org.apache.xmlgraphics:batik-transcoder:1.7
+-org.apache.xmlgraphics:batik-gvt:1.7
+-xml-apis:xml-apis:1.3.04
and
+-org.bbraile:bbraile:1.0-SNAPSHOT
+-org.apache.xmlgraphics:batik-transcoder:1.7
+-org.apache.xmlgraphics:batik-svg-dom:1.7
+-xml-apis:xml-apis:1.3.04
and
+-org.bbraile:bbraile:1.0-SNAPSHOT
+-org.apache.xmlgraphics:batik-transcoder:1.7
+-org.apache.xmlgraphics:batik-svggen:1.7
+-xml-apis:xml-apis:1.3.04
and
+-org.bbraile:bbraile:1.0-SNAPSHOT
+-org.apache.xmlgraphics:batik-transcoder:1.7
+-xml-apis:xml-apis:1.3.04
要根据我读过的内容修复此问题,我应该将其添加到我的POM中
<dependencyManagement>
<dependencies>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>2.0.2</version>
</dependency>
</dependencies>
</dependencyManagement>
然后重新运行我的程序.它通过了maven-enforcer-plugin检查但我的classpath现在说我正在运行xml-apis:xml-apis:1.0.b2.版本号是如何变老的?为什么我的版本会被忽略?
将此添加到我的POM,无论是否有< version>标签没有效果
<dependencies>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>2.0.2</version>
</dependency>
</dependencies>
咨询依赖:树-Dverbose = true -Dincludes = xml-apis在下面给出,这意味着2.0.2
org.bbraile:bbraile:jar:1.0-SNAPSHOT
+- org.bbraile:utd:jar:1.0-SNAPSHOT:compile
| +- xalan:xalan:jar:2.7.2:compile
| | \- xalan:serializer:jar:2.7.2:compile
| | \- (xml-apis:xml-apis:jar:2.0.2:compile - version managed from 1.0.b2; omitted for duplicate)
| +- (xml-apis:xml-apis:jar:2.0.2:compile - version managed from 1.0.b2; omitted for conflict with 1.0.b2)
| \- xerces:xercesImpl:jar:2.11.0:compile
| \- (xml-apis:xml-apis:jar:2.0.2:compile - version managed from 1.0.b2; omitted for duplicate)
+- com.io7m.xom:xom:jar:1.2.10:compile
| \- (xml-apis:xml-apis:jar:2.0.2:compile - version managed from 1.0.b2; omitted for duplicate)
+- org.apache.xmlgraphics:batik-transcoder:jar:1.7:compile
| +- org.apache.xmlgraphics:batik-bridge:jar:1.7:compile
| | +- org.apache.xmlgraphics:batik-anim:jar:1.7:compile
| | | +- (xml-apis:xml-apis:jar:2.0.2:compile - version managed from 1.0.b2; omitted for duplicate)
| | | \- (xml-apis:xml-apis-ext:jar:1.3.04:compile - omitted for duplicate)
| | +- org.apache.xmlgraphics:batik-css:jar:1.7:compile
| | | +- (xml-apis:xml-apis:jar:2.0.2:compile - version managed from 1.0.b2; omitted for duplicate)
| | | \- (xml-apis:xml-apis-ext:jar:1.3.04:compile - omitted for duplicate)
| | +- org.apache.xmlgraphics:batik-ext:jar:1.7:compile
| | | \- (xml-apis:xml-apis:jar:2.0.2:compile - version managed from 1.0.b2; omitted for duplicate)
| | +- (xml-apis:xml-apis:jar:2.0.2:compile - version managed from 1.0.b2; omitted for duplicate)
| | \- (xml-apis:xml-apis-ext:jar:1.3.04:compile - omitted for duplicate)
| +- org.apache.xmlgraphics:batik-dom:jar:1.7:compile
| | +- (xml-apis:xml-apis:jar:2.0.2:compile - version managed from 1.0.b2; omitted for duplicate)
| | \- (xml-apis:xml-apis-ext:jar:1.3.04:compile - omitted for duplicate)
| +- org.apache.xmlgraphics:batik-gvt:jar:1.7:compile
| | \- (xml-apis:xml-apis:jar:2.0.2:compile - version managed from 1.0.b2; omitted for duplicate)
| +- org.apache.xmlgraphics:batik-svg-dom:jar:1.7:compile
| | +- (xml-apis:xml-apis:jar:2.0.2:compile - version managed from 1.0.b2; omitted for duplicate)
| | \- (xml-apis:xml-apis-ext:jar:1.3.04:compile - omitted for duplicate)
| +- org.apache.xmlgraphics:batik-svggen:jar:1.7:compile
| | \- (xml-apis:xml-apis:jar:2.0.2:compile - version managed from 1.0.b2; omitted for duplicate)
| +- (xml-apis:xml-apis:jar:2.0.2:compile - version managed from 1.0.b2; omitted for duplicate)
| \- xml-apis:xml-apis-ext:jar:1.3.04:compile
\- xml-apis:xml-apis:jar:2.0.2:compile
为什么我的dependencyManagment中的显式版本被忽略了?为什么设置会减少我的类路径上的版本?如何使用最新的xml-apis版本传递maven-enforcer-plugin?
解决方法:
事实证明这不是一个maven问题,这是一个xml-api的问题.截至今天,这是xml-apis:xml-apis在Maven Central中的外观
如果你仔细看2.0.2不是最新版本,1.4.01就是!虽然其他人和他们的IDE认为2大于1,但xml-apis会倒退.
这是非常令人困惑和不明显的,所以希望有人发现这很有用.
内容总结
以上是互联网集市为您收集整理的java – 使用xml-apis混淆传递依赖行为全部内容,希望文章能够帮你解决java – 使用xml-apis混淆传递依赖行为所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。