GraalVM also has an agent for Gradle and Maven which can do this.
But you do need to start/run your app once to get the agent to do its stuff.
https://www.graalvm.org/latest/reference-manual/native-image...
(it is part of the graalvm so use that as your jvm to do this)