Skip to content

Add support for JLink plugins#603

Open
Til7701 wants to merge 8 commits intoapache:masterfrom
Til7701:plugin
Open

Add support for JLink plugins#603
Til7701 wants to merge 8 commits intoapache:masterfrom
Til7701:plugin

Conversation

@Til7701
Copy link
Copy Markdown

@Til7701 Til7701 commented Mar 28, 2025

Fixes #602

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Make sure there is a GitHub issue filed
    for the change (usually before you start working on it). Trivial changes like typos do not
    require a GitHub issue. Your pull request should address just this issue, without
    pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [#<num>] - Fixes bug in ApproximateQuantiles,
    where you replace #<num> with the appropriate GitHub issue. Best practice
    is to use the GitHub issue title in the pull request title and in the first line of the
    commit message.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean verify to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its clean verify).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

Description

This PR add support for the JLink options --generate-cds-archive and --order-resources.
Additionally, it adds the ability to supply additional args to JLink to support undocumented plugins. See #602 for a list of those.

@elharo elharo changed the title [#602] - Add support for JLink plugins Add support for JLink plugins Apr 14, 2025
@Til7701
Copy link
Copy Markdown
Author

Til7701 commented Apr 14, 2025

The tests are failing, because some of the introduced plugin options are not available with all JDK vendors.
Is there a way to disable tests with some JDKs? I have never seen this test setup before. Maybe I could check in the groovy script, but I don't know, whether this is the right way.

@bmarwell
Copy link
Copy Markdown
Contributor

Hi @Til7701 -- you are right, CDS is a hotspot-specific thing, but other Java vendors like IBM may chose to replace hotspot and its CDS with something else -- like Eclipse OpenJ9 as Memory-Management and GC implementation with SCC (shared class cache) as an almost equivalent implementation.
Maybe we need something for the tests to be marked as "only run on HotSpot" vs "only run on OpenJ9" based JVMs.

@bmarwell bmarwell requested a review from rfscholte August 27, 2025 19:03
pom.xml Outdated
Comment on lines +267 to +268
<!-- This test does not work for all jdk vendors and versions -->
<pomExclude>cli-options/generate-cds-archive/pom.xml</pomExclude>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move the exclusion into a profile?
The profile could get activated by the existence of the property openj9.compiler or if the property java.vm.vendor equals Eclipse OpenJ9 or if java.vendor equals IBM Corporation.

Copy link
Copy Markdown
Author

@Til7701 Til7701 Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added profiles for the exclusion. I had to create one for each, since Maven cannot activate a profile based on multiple properties.

@Til7701 Til7701 requested a review from bmarwell August 28, 2025 13:40
@bmarwell
Copy link
Copy Markdown
Contributor

OK, one more thing. The option generate-cds-archive cannot be used before Java 17.

The files you added (e.g. src/it/projects/cli-options/additional-args/invoker.properties) should reflect this. You need to add invoker.java.version = 17+.

Copy link
Copy Markdown

@Maran23 Maran23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice addition I also really would like to use!
The tests follow the pattern of the existing ones. So look good to me too.

Note that I'm not an Maven Plugin Expert. But the Mojo code (and resulting JLink command) look fine. Tests follow the pattern of the existing tests. I have 2 comments here.

<url>http://maven.apache.org</url>
<description>Test JLink CLI Options --generate-cds-archive.</description>
<properties>
<maven.compiler.source>17</maven.compiler.source>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the single maven.compiler.release instead of source and target here and in the other pom.xmls.

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed when we set the release version above? (also in the other pom.xml)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for JLink plugins

3 participants