Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create modular runtime image #1

Open
donmendelson opened this issue Aug 12, 2019 · 8 comments
Open

Create modular runtime image #1

donmendelson opened this issue Aug 12, 2019 · 8 comments

Comments

@donmendelson
Copy link
Member

Define a module and create a runtime image.

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

@donmendelson donmendelson added the help wanted Extra attention is needed label Aug 16, 2019
@donmendelson
Copy link
Member Author

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
Copy link
Member Author

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 donmendelson removed the help wanted Extra attention is needed label Sep 2, 2019
@donmendelson
Copy link
Member Author

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
Copy link
Member Author

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
Copy link
Member Author

The jlink utility supports multiple entry points, but Moditect plugin doesn't. Issue entered at moditect/moditect#104

donmendelson added a commit to donmendelson/xml-diff-merge that referenced this issue Sep 4, 2019
donmendelson added a commit to donmendelson/xml-diff-merge that referenced this issue Sep 4, 2019
@donmendelson
Copy link
Member Author

donmendelson commented Dec 26, 2019

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

donmendelson added a commit that referenced this issue Dec 26, 2019
@donmendelson
Copy link
Member Author

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
Copy link
Member Author

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

donmendelson added a commit that referenced this issue Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant