Home > Mobile >  How can I use saxon but a Maven dependency use sax? [closed]
How can I use saxon but a Maven dependency use sax? [closed]

Time:10-09

I use Saxon in my maven java project. Now I want to use a library that use org.xml.sax and is incompatible with saxon.

How I can say that saxon should not working for the library but for all other parts of my project?

Any ideas? Thank you for any help.

CodePudding user response:

Two possibilities:

  • Avoid the overlap by changing the libraries you use
  • Use the Maven shade plugin to change the packages of certain dependencies

CodePudding user response:

What exactly is the incompatibility? org.xml.sax is a Java interface, present in the JDK, and it has been stable for many years, so it seems highly unlikely that there are different versions of it around. Many libraries use org.xml.sax, including Saxon, and they normally work together quite happily.

Perhaps it's not actually to do with org.xml.sax at all? A more common problem is that in one part of your application you want to use Saxon and in another part you want to use Xalan: both of these provide implementations of the JAXP TransformerFactory service, so using both at the same time is a little tricky. But not impossible.

But the first thing we need to do is establish exactly what your problem is. As always: tell us exactly what you are doing, and tell us exactly how it fails.

  • Related