quarkus - 在本机编译期间,如何在 Quarkus maven 插件中将参数添加到 GraalVM?
问题描述
当我为我的应用程序构建本机映像时,我遇到了一些我不理解的错误。
Error: unsupported features in 3 methods
Detailed message:
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getConstantPool() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
Graal 建议我设置此选项 --report-unsupported-elements-at-runtime
我试图把类似的东西:
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.version}</version>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<configuration>
<enableHttpUrlHandler>true</enableHttpUrlHandler>
<containerRuntimeOptions>--report-unsupported-elements-at-runtime</containerRuntimeOptions>
</configuration>
</execution>
</executions>
</plugin>
但选项没有出现:
[INFO] [io.quarkus.creator.phase.nativeimage.NativeImagePhase] /sandbox/Resources/GraalVm/graalvm-ce-1.0.0-rc15/bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar portfolio-app-1.0-SNAPSHOT-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+PrintAnalysisCallTree -H:-AddAllCharsets -H:EnableURLProtocols=http,https --enable-all-security-services -H:NativeLinkerOption=-no-pie -H:-SpawnIsolates -H:+JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace
如何添加 --report-unsupported-elements-at-runtime ?(我使用 Quarkus-bom 0.14.0 和 graalvm-ce-1.0.0-rc15)
解决方案
在这种情况下,最好的方法是使用:
<reportErrorsAtRuntime>true</reportErrorsAtRuntime>
在您的 native-image 目标的配置中。
推荐阅读
- spring - MongoDB Springboot Query 注释只给出第一条记录
- tensorflow - Keras-二元多标签分类的加权二元交叉熵
- node.js - 如何在github上将客户端和服务器端项目文件夹作为一个项目(api +前端)一起推送?
- php - 选择下拉菜单始终显示最后一个选择
- azure - 如何为相同资源类型的多个资源创建不同的指标类型警报
- python - 如何解析 Airflow 中的嵌套宏
- c# - 如何使用 c# 运行 exe 文件(我不能使用 Process.Start() 因为我不知道 exe 文件的位置)
- java - JSF @Inject 机制返回 NullPointerException
- python-3.x - 如何让 Python 什么都不做
- python - 无需训练模型的人指甲分割