RFR: 8303884: jlink --add-options plugin does not allow GNU style options to be provided
Yasumasa Suenaga
ysuenaga at openjdk.org
Mon Jul 29 12:57:32 UTC 2024
On Mon, 29 Jul 2024 07:36:15 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> So how should we proceed this? This problem is critical for some modularized applications as I said before.
>>
>> I agree that we need to consider the approach for this, but it is worth to provide the fix even if it is short-term, I think. I believe we can ensure not to break current behavior with jtreg tests.
>
> Hello @YaSuenag, like Alan noted, I believe the options parsing for jlink will need a bigger change. The current proposed change has the potential to have unexpected side effects where an option that wasn't expected to be passed to a plugin for parsing, might now end up being passed to the plugin. The fact that the current tests aren't catching that issue is also a sign that we might need additional test coverage in this area.
>
>> This problem is critical for some modularized applications as I said before.
>
> Do you have an example `jlink` command line where you are running into problems with the `--add-options`? As far as I know, there are workarounds to get `--add-options` to behave correctly and be able to pass along the expected values in the generated image. Depending on your example, we might be able to suggest a workaround until the options parsing is reworked.
@jaikiran
This is the case what I want to do.
https://github.com/YaSuenag/perfreader/blob/4844ac54b375d73b4ee981a90cd3b3b3e0245ab6/pom.xml#L71-L76
<argument>--add-options</argument>
<argument>-XX:+HeapDumpOnOutOfMemoryError --add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=perfreader --add-exports=jdk.internal.jvmstat/sun.jvmstat.perfdata.monitor=perfreader</argument>
We cannot pass `--add-exports` straightly as you know, but we can avoid the issue to add the option which starts with `-` to the top of args (it is similar with the workaround which is shown in JDK-8303884). So I've added `-XX:+HeapDumpOnOutOfMemoryError`, but it is ugly a bit I think.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19987#issuecomment-2255858298
More information about the core-libs-dev
mailing list