Open abhinayagarwal opened 4 years ago
As explained in a previous issue, we need this kind of options in projects where the required modules are determined dynamically by maven. Using the newly merged PR 92, the run
goal can now be configured with something like:
<runtimePathOption>MODULEPATH</runtimePathOption>
<options>--add-modules ALL-MODULE-PATH</options>
This brings all maven dependencies into the module graph. But we now need the ability to tell jlink
to also add all dependencies to the image.
Something like you suggest (and already start to implement) would do:
<jlinkOptions>--add-modules ALL-MODULE-PATH</jlinkOptions>
Or you could consider that all modules that were needed on the module path to javafx:run
are also needed in the image and make this the default.
Or you could do something still more clever by automatically append in --add-modules
all modules in the module path but only NAMED modules, since jlink will fail to add automatic modules to the image.
Another related issue: since mainClass
is a required option without default value, the <plugin>
blocks must have a child <configuration>
block with at least <mainClass>
. So we must have a common <configuration>
block for both goals. However if run
and jlink
need different values for the <option>
parameter, we are stuck.
The current
<option>
configuration is used to provide options to thejava
command for bothjavafx:run
andjavafx:jlink
goals. In case ofjavafx:jlink
, the options are passed to the launcher script which seems to work well.However, user may need to pass options to
jlink
command. There is no way to do it right now.My suggestion is to include a new configuration
jlinkOptions
which would enable users to define flags which will be directly passed to thejlink
command.