FIXTradingCommunity / xml-diff-merge

XML difference and merge utilities
Apache License 2.0
6 stars 6 forks source link

Create modular runtime image #1

Open donmendelson opened 5 years ago

donmendelson commented 5 years ago

Define a module and create a runtime image.

The code requires module java.xml and has dependency Saxon-HE.

donmendelson commented 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.

donmendelson commented 5 years ago

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.

donmendelson commented 5 years ago

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.

donmendelson commented 5 years ago

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.

donmendelson commented 5 years ago

The jlink utility supports multiple entry points, but Moditect plugin doesn't. Issue entered at https://github.com/moditect/moditect/issues/104

donmendelson commented 4 years ago

Works with fork donmendelson/moditect, but making image generation optional for now.

donmendelson commented 3 years ago

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

donmendelson commented 3 years ago

Workaround for now is to build an assembly with all dependencies.