javafx-maven-plugin icon indicating copy to clipboard operation
javafx-maven-plugin copied to clipboard

Configuration to provide jlink options

Open abhinayagarwal opened this issue 5 years ago • 1 comments

The current <option> configuration is used to provide options to the java command for both javafx:run and javafx:jlink goals. In case of javafx: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 the jlink command.

abhinayagarwal avatar Oct 07 '20 13:10 abhinayagarwal

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.

HGuillemet avatar Oct 16 '20 15:10 HGuillemet