Xerces dependency and JRE

Due to some classpath issues, I'm removing the Maven dependency to Xerces from my application. As I understand it, that is no longer needed as it is in the JRE. However, when compiling a junit that uses org.apache.xml.serialize.OutputFormat and org.apache.xml.serialize.XMLSerializer, those imports are no longer found.

Should I add Xerces as "provided" scope or are these classes not provided in the JRE? Are Xerces and other libraries packaged into other JARs in the JRE? I couldn't find it on the file system so I'm not sure which version to use in Maven provided dependency.


The preferred solution seems to be to only use the Java APIs, so I removed org.apache.xml.serialize.OutputFormat and used the following for formatting:

final TransformerFactory tf = TransformerFactory.newInstance();
final Transformer transformer = tf.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");

Now I no longer need the Xerces dependency at all.

链接地址: http://www.djcxy.com/p/44080.html

上一篇: Spring Data JPA就像不依赖于Spring的项目

下一篇: Xerces依赖和JRE