I’m using a (Maven) dependency which itself depends on xml-apis
. Unfortunately, the presence of this package now causes conflicts in our OSGi environment (see below in case it should be relevant).
Looking at the JAR content, I find classes which seem to be present in a current JRE anyways. So, my question: Is it safe to exclude this dependency?
In general: Is there any official documentation about classes which used to be stand alone dependencies and which have been integrated into the JRE now?
Here’s the mentioned OSGi error when the created xml-apis
bundle is present:
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.
Advertisement
Answer
You can define the xml-apis as an explicit dependency in the pom.xml of your project with the scope “provided”. Then it will not be part of the runtime dependencies.