【问题标题】:xml-apis JAR file necessary?xml-apis JAR 文件是必要的吗?
【发布时间】:2017-07-13 15:55:33
【问题描述】:

我正在使用一个(Maven)依赖项,它本身依赖于xml-apis。不幸的是,这个包的存在现在会在我们的 OSGi 环境中引起冲突(如果它应该相关,请参见下文)。

查看 JAR 内容,我发现无论如何似乎都存在于当前 JRE 中的类。所以,我的问题是:排除这种依赖是否安全?

总的来说:是否有任何关于类的官方文档,这些类曾经是独立的依赖项,现在已集成到 JRE 中?


当创建的 xml-apis 包存在时,这里提到的 OSGi 错误:

Bundle was not resolved because of a uses contraint violation.
  org.osgi.service.resolver.ResolutionException: Uses constraint violation. Unable to resolve resource my.company.plugin [osgi.identity; osgi.identity="my.company.plugin"; type="osgi.bundle"; version:Version="2.0.0.201707131542"; singleton:="true"] because it is exposed to package 'javax.xml.transform' from resources org.eclipse.osgi [osgi.identity; type="osgi.bundle"; version:Version="3.11.1.v20160708-1632"; osgi.identity="org.eclipse.osgi"; singleton:="true"] and xml-apis [osgi.identity; type="osgi.bundle"; version:Version="1.4.1.bnd-vA0Q7A"; osgi.identity="xml-apis"] via two dependency chains.

【问题讨论】:

    标签: java maven dependencies


    【解决方案1】:

    您可以将 xml-apis 定义为项目的 pom.xml 中的显式依赖项,其范围为“provided”。那么它将不会成为运行时依赖项的一部分。

    【讨论】:

    • 谢谢,我知道如何排除它们了。我的问题针对潜在的负面影响。
    • 由于 Java XML API 已在 Java 5 中得到认可,因此可以安全地假设它们已提供。我认为没有人在使用 JDK
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-01-19
    • 1970-01-01
    • 2015-07-15
    • 2015-05-21
    • 2014-07-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多