-
Notifications
You must be signed in to change notification settings - Fork 3
Description
When building a complex Java extension which we wish to use EXPath XAR packaging for, the Java application will have dependencies other than its own class files which need to be included in the EXPath package.
These dependencies are correctly expressed in the pom.xml and we can for example use the Maven Shade (or even the Maven Assembly) plugin to assemble an uber/fat jar which contains all of the class files that we would need if we were distributing as a Java artifact.
However, when using the XAR plugin we need to also include all of the transitive dependencies of the project manually as it fails to detect these correctly whereas the Shade or Assembly plugins do. Including all these manually is frustrating as we have to repeat all the dependencies (which are effectively runtime scope) from the pom.xml into the xar-assembly.xml.
For examples see:
- https://github.com/eXist-db/expath-file-module/blob/master/xar-assembly.xml#L26
- https://github.com/adamretter/exist-sparql/blob/fix-build/xar-assembly.xml#L25
I can see two possible solutions:
- Fix the XAR plugin so that it correctly also pulls in the transitive dependencies which are already defined in the
pom.xml. - Add a
classifierto thedependencySetin thexar-assembly.xmlwhich allows us to specify the shaded artifact for our project (which will already include all transitive dependencies).
Ideally I think we should implement both facilities. I also think there is room for cleaning up the xar-assembly.xml and its dependencySet and fileSet features, to make them behave more on convention and to use more of the information that is already defined in the pom.xml without having to repeat ourselves.
I would be happy to undertake some work to do an overhaul of the plugin and improve it to be more Maven like ;-) Thoughts?