Skip to content
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

Add possibility to pass arguments before -cp command in native-maven-plugin #641

Open
maximkovalenko-hc opened this issue Nov 22, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@maximkovalenko-hc
Copy link

We're trying to use -H:+UnlockExperimentalVMOptions option in native-maven-plugin to get rid form native compilation warnings:

14 26.97 Warning: The option '-H:ReflectionConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-websocket/tomcat-reflection.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
14 26.97 Warning: The option '-H:ReflectionConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/tomcat-reflection.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
14 26.97 Warning: The option '-H:ResourceConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-resource.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
14 26.97 Warning: The option '-H:ReflectionConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-reflection.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
14 26.97 Warning: The option '-H:IncludeResources=rabbitmq-amqp-client.properties|version.properties' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
14 26.97 Warning: The option '-H:ResourceConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/tomcat-resource.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
14 26.97 Warning: The option '-H:ResourceConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-websocket/tomcat-resource.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.

It works only when -H:+UnlockExperimentalVMOptions option is before -cp command.

Please add a possibility to pass arguments before -cp command in native-maven-plugin.

@maximkovalenko-hc maximkovalenko-hc added the enhancement New feature or request label Nov 22, 2024
@vjovanov
Copy link
Member

vjovanov commented Dec 2, 2024

@maximkovalenko-h thank you for reporting. We will discuss this at our next meeting to find a solution.

In the meanwhile, have you opened a ticket for org.apache.tomcat to fix this in their jars? ResourceConfigurationResources should not even be used already for a long while.

@maximkovalenko-hc
Copy link
Author

Hello @vjovanov, thank you.
Yes, we reported it to Tomcat team.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69465

@olpaw
Copy link
Member

olpaw commented Dec 3, 2024

While I agree that in this instance the right solution is to fix the tomcat artifacts to not use deprecated options anymore, the request to allow to control the place where -cp ... gets emitted in the native image command is valid.

The right way to provide that for maven is to use the maven exec plugin for inspiration.
See https://www.mojohaus.org/exec-maven-plugin/examples/example-exec-for-java-programs.html

I.e. we could also introduce <classpath/> and <modulepath/> to be allowed in our <buildArgs>.
If found, we would expand it and suppress our implicit adding of -cp ... (-p ... respectively).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants