<div dir="ltr"><div dir="ltr">On Tue, Apr 25, 2023 at 2:48 PM Alan Bateman <<a href="mailto:Alan.Bateman@oracle.com" target="_blank">Alan.Bateman@oracle.com</a>> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
    The command line parsing in jlink doesn't currently allow the
    argument for a plugin use GNU style options. There are workarounds,
    e.g. `--add-options \ --add-modules=foo,bar` so you mileage might
    vary on this.<br></div></blockquote><div><br></div><div>I'm calling jlink through its ToolProvider and it does indeed work to simply add a space just before --add-modules=, like this:</div><div><br></div><div>String[] options = new String[] {"--add-options", " --add-modules=" +String.join(",", addModules), ...};<br></div><div><br></div><div>The leading space makes following check of the --add-options param value in TaskHelper.OptionsHelper not match and throw BadArgs:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">if (param == null || param.isEmpty()<br>        || (param.length() >= 2 && param.charAt(0) == '-'<br>        && param.charAt(1) == '-')) {<br>    throw new BadArgs("err.missing.arg", name).<br>            showUsage(true);<br>}</blockquote><div><br></div><div>The logic here could probably be improved.</div><div><br></div><div>Thanks,</div><div>Eirik. </div></div></div>