Skip to content

Add runtimeArgs support to native-maven-plugin #734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2025

Conversation

linghengqian
Copy link
Contributor

@linghengqian linghengqian commented May 31, 2025

@alvarosanchez
Copy link
Member

With regards to testing this with Spock, you can use @Requires({ jvm.java23Compatible }) but apart from this, is there any other runtime arg that you can test with?

@linghengqian
Copy link
Contributor Author

linghengqian commented Jun 3, 2025

is there any other runtime arg that you can test with?

  • I would say I have no idea. The GraalVM doc only mentions this one available runtime arg.

With regards to testing this with Spock, you can use @requires({ jvm.java23Compatible }) but apart from this,

  • I submitted a new commit to supplement the unit tests, but there is still an awkward problem. It seems that the gradle wrapper 7.4 used by the native-maven-plugin module does not support the JDK 23 runtime. I say this is awkward because I'm testing on Windows and can't set a session-level environment variable GRAALVM_HOME like Ubuntu can.

alvarosanchez
alvarosanchez previously approved these changes Jun 3, 2025
Copy link
Member

@alvarosanchez alvarosanchez left a comment

Choose a reason for hiding this comment

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

@dnestoro please help @linghengqian to write a test for this. The one added here is still skipped.

Other than that, this LGTM

@linghengqian thank you for your patience and collaboration!

@@ -5,6 +5,10 @@

This version introduces a breaking change: the plugin now requires Java 17 to run.

=== Maven plugin
Copy link
Member

Choose a reason for hiding this comment

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

@dnestoro will this go into 0.11.0? If not, please adjust it

@dnestoro
Copy link
Collaborator

The one added here is still skipped

I believe that is because the test is annotated with @requires({ jvm.java23Compatible }) (and we are running our dev builds on JDK25).

@linghengqian sorry for the late response. Can you try something like this. You can calculate currently used version like this:

def getCurrentJDKVersion() {
        return NativeImageUtils.getMajorJDKVersion(GraalVMSupport.getGraalVMHomeVersionString())
}

and then your requires annotation should be something like

@Requires({ getCurrentJDKVersion() >= 23 })

Copy link
Contributor Author

@linghengqian linghengqian left a comment

Choose a reason for hiding this comment

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

@linghengqian linghengqian force-pushed the add-run-arg branch 2 times, most recently from 819f0d0 to c8ea3f2 Compare June 21, 2025 14:39
Copy link
Contributor Author

@linghengqian linghengqian left a comment

Choose a reason for hiding this comment

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

sorry for the late response. Can you try something like this. You can calculate currently used version like this:

@dnestoro
Copy link
Collaborator

dnestoro commented Jun 23, 2025

@linghengqian thanks for your contribution. From testing side it looks okay now. Since you force pushed commits, original approval from @alvarosanchez is dismissed.

@alvarosanchez can you please re-approve the PR if it is still okay (since I don't know the previous state of PR and there is only one commit in history)

@dnestoro dnestoro merged commit fe96912 into graalvm:master Jun 23, 2025
161 checks passed
@linghengqian linghengqian deleted the add-run-arg branch June 23, 2025 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
3 participants