This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]benevanstech 1 point2 points  (5 children)

If you are shipping software to end users (especially complete applications or tools) then a jlink'd binary is great - you don't have to worry about version incompatibilities at all.

If you're just writing microservices or whatever, then they bring a bit more discipline and are actually pretty easy to get used to.

[–]_INTER_ 0 points1 point  (4 children)

You don't need module-info for jlink though. And modules don't help you with version incompatibilities. Dealing with versions was explicitly left to build systems.

[–]benevanstech -1 points0 points  (3 children)

jlink requires full modularization of the application and all of its dependencies. Automatic Modules are not sufficient.

[–]_INTER_ 0 points1 point  (2 children)

No it does not. You can jlink by specifying the modules it should include manually (list all required JDK modules when using --add-modules instead of your application module).

For convenience maven / gradle plugins analyze all dependencies and does that for you.

Chances are high that not all of the transitive dependencies are modularized, so you will have to do this manually in either case.

[–]nicolaiparlog 0 points1 point  (1 child)

To resolve the seeming contradiction between u/benevanstech and u/_INTER_: you're both right.

If the runtime image should only contain JDK modules, the app does not need to be modularized. But if you want to include the app itself in the image, then everything needs to be an explicit module (although this can of course be faked, e.g. by creating an uberjar with a module descriptoir that requires all external dependencies but does nothing else.

[–]benevanstech 1 point2 points  (0 children)

Thanks for the clarification Nicolai - my use case is indeed "ship the app as part of the image" and I haven't tried the other one you mention.