当我尝试从 uberjar 构建本机映像时出现以下错误
运行以下命令:
./mvnw verify \
-Pnative -Dquarkus.test.native-image-wait-time=300 \
-Djavacpp.platform=${OSNAME}-x86_64
从 uberjar 构建本机图像。
期望最终的原生图像,而不是收到以下错误消息:
Error: substitution target for io.quarkus.runtime.graal.QuarkusReplacement$GenMain is not loaded. Use field `onlyWith` in the `TargetClass` annotation to make substitution only active when needed.
com.oracle.svm.core.util.UserError$UserException: substitution target for io.quarkus.runtime.graal.QuarkusReplacement$GenMain is not loaded. Use field `onlyWith` in the `TargetClass` annotation to make substitution only active when needed.
at com.oracle.svm.core.util.UserError.abort(UserError.java:65)
at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.findTargetClass(AnnotationSubstitutionProcessor.java:823)
at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleClass(AnnotationSubstitutionProcessor.java:252)
at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.init(AnnotationSubstitutionProcessor.java:230)
at com.oracle.svm.hosted.NativeImageGenerator.createDeclarativeSubstitutionProcessor(NativeImageGenerator.java:875)
at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:824)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:524)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:444)
at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error: Image build request failed with exit status 1
有点不确定我是否错过了添加任何必要的 Quarkus 扩展。