Replies: 2 comments
-
It sounds like you're facing a challenging issue with the build-time initialization configuration in your Maven project, especially with dependencies that have their own native-image.properties settings. Here are a few strategies you might consider to address this problem:
Example Configuration META-INF/native-image/native-image.propertiesArgs = --initialize-at-build-time=org.tinylog.runtime.ModernJavaRuntime
Summary • Reflection Configuration: Use reflect-config.json to handle reflection. • Substitution Classes: Replace problematic classes with your own implementations. • Excluding Unnecessary Dependencies: Modify pom.xml to exclude problematic dependencies. • Using GraalVM's --initialize-at-run-time Option: Specify runtime initialization for certain classes. • Community and Support: Seek help from the community or library maintainers. By carefully configuring your project and leveraging GraalVM's options, you should be able to resolve the initialization issues and build your project successfully. If you need further assistance, feel free to ask! |
Beta Was this translation helpful? Give feedback.
-
Pal, you just ripped that straight from ChatGPT. None of that helps or makes sense given what I said. Grow up. |
Beta Was this translation helpful? Give feedback.
-
Here's my issue, who has some advice? :)
I have a Maven project with some well-known dependencies specified (netty, azure-code for example), those dependencies have their own
native-image.properties
that have something like (note, build-time):My project doesn't use logback firstly, it uses tinylog/slf4j. But because of the build-time initialization configuration in these libs, I'm forced to include (via determining through the errors), a bunch of tinylog classes in my project's configuration as build-time initialisation too, presumably because the SLJ4J bindings all lead back to tinylog and so they all need to be built-time.
Although I'd rather not have to do all of this hackery, I thought maybe all fine, as a once off. Until I eventually am forced to try to add this as a build-time init:
java.lang.ProcessHandleImpl
.Why? Well tinylog has a class that's being instantiated during init'ing via the logging providers -- and that class is called
org.tinylog.runtime.ModernJavaRuntime
, and it has this:And this seems to be used to return a process ID to the logging provider registry, or whatever.
Regardless, I cannot add
ProcessHandle
orProcessHandleImpl
with build-time init config, as I get this:...so I'm completely stuck. And I honestly don't want to go down to the level of adding dozens of classes, anyway.
What's really frustrating is that I only want to access a few classes in these libraries -- I don't care about their own logging or most of their functionality. I don't know why they have such complex build-time configurations, but I bet it's related to logback and logging. And I cannot override or ignore the
native-image.properties
config (e.g., make everything run-time and see what happens). If you try that, GraalVM complains about that.What can I do here? Of course I fork, tweak the config, and re-publish the libraries as my own, but that's not a feasible solution, even if it worked (which it might not).
Beta Was this translation helpful? Give feedback.
All reactions