Open donmendelson opened 5 years ago
A problem is that Saxon-HE is not modular, and jlink only operates on modules. The jdeps utility can generate module.info file, but it still needs to be put in the jar. Moditect plugin looks promising, but it is still in beta.
I would appreciate help from anyone who has experience with this issue.
Experimenting with Moditect plugin. One discovery is that Saxon HE requires jlink parameter --ignore-signing-information.
Suppresses a fatal error when signed modular JARs are linked in the runtime image. The signature-related files of the signed modular JARs aren’t copied to the runtime image.
Now the build is working outside of Eclipse. When I run it in Eclipse, jlink gives an error about duplicate pom.xml, but apparently Eclipse is doing that.
I specified a launcher for XmlDiff, and jlink creates a little script for it. Apparently only one launcher can be created so XMLMerge requires a command line. xmldiff script works, but override for XMLMerge is not working.
Error: Unable to initialize main class io.fixprotocol.xml.XmlMerge in module module diff.merge Caused by: module diff.merge: java.lang.IllegalAccessError
Why? XMLMerge is public.
The jlink utility supports multiple entry points, but Moditect plugin doesn't. Issue entered at https://github.com/moditect/moditect/issues/104
Works with fork donmendelson/moditect, but making image generation optional for now.
Another option to consider is it use GraalVM ahead-of-time compiler to build a native executable. See https://www.graalvm.org/docs/getting-started/#native-images
Workaround for now is to build an assembly with all dependencies.
Define a module and create a runtime image.
The code requires module java.xml and has dependency Saxon-HE.