Java 9 Dependency Injection
上QQ阅读APP看书,第一时间看更新

JLink – Module Linker

When we are talking about modular systems, then immediately one question comes, how dependencies  of modules will organize and what will be impact on final deployment?

The JLink tool is designed to provide optional phases between compile time and runtime, called link time, which links a set of modules and its transitive dependencies to create runtime images. JLink makes deployment simpler and also reduces the size of an application.

The invocation syntax of jLink is as follows:

jlink --module-path <modulepath> --add-modules <modules> --limit-modules <modules> --output <path>

--module-path - jLink use module path for finding modules such as modular jars, JMOD files
--add-modules - Mention module which needs to include in default set of modules for run time image, by default set of modules in empty.
--limit-modules - Use this option to limits modules, which is required for our application.
--output - Final resulting run time image will be stored in output directory
--help - list details about jLink options
--version - show the version number