We are building a common component that is a dependency for multiple other projects.
Our project does some XSLT transformations and we need to use the Saxon engine.
We have full control over the specific XSLT transformation that must use Saxon, but no control over the classpath of the applications that are dependent on us, and we don't want to force them to use Saxon for other XML work.
We can manually invoke the Saxon library directly when doing our transformations using the API provided by those factories.
The problem is that Saxon uses the
Answering this for any future developers with the same issue.
We were not able to find a way to solve this issue. We considered writing a Maven plugin to remove the
META-INF/services/ file from the JAR but ultimately decided this was not an appropriate solution.
We are now in the same position we started - dependent applications end up with Saxon as a registered provider and it might override their existing configuration.
For those applications that must use a specific XSLT processer we have asked them to set the system property, e.g.