diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java index 9e4898fef0687..129e351cd2351 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java @@ -677,19 +677,21 @@ public NativeImageInvokerInfo build() { } nativeImageArgs.add("--features=" + String.join(",", featuresList)); - /* - * Instruct GraalVM / Mandrel parse compiler graphs twice, once for the static analysis and once again - * for the AOT compilation. - * - * We do this because single parsing significantly increases memory usage at build time - * see https://github.com/oracle/graal/issues/3435 and - * https://github.com/graalvm/mandrel/issues/304#issuecomment-952070568 for more details. - * - * Note: This option must come before the invocation of - * {@code handleAdditionalProperties(nativeImageArgs)} to ensure that devs and advanced users can - * override it by passing -Dquarkus.native.additional-build-args=-H:+ParseOnce - */ - nativeImageArgs.add("-H:-ParseOnce"); + if (graalVMVersion.isOlderThan(GraalVM.Version.VERSION_22_2_0)) { + /* + * Instruct GraalVM / Mandrel parse compiler graphs twice, once for the static analysis and once again + * for the AOT compilation. + * + * We do this because single parsing significantly increases memory usage at build time + * see https://github.com/oracle/graal/issues/3435 and + * https://github.com/graalvm/mandrel/issues/304#issuecomment-952070568 for more details. + * + * Note: This option must come before the invocation of + * {@code handleAdditionalProperties(nativeImageArgs)} to ensure that devs and advanced users can + * override it by passing -Dquarkus.native.additional-build-args=-H:+ParseOnce + */ + nativeImageArgs.add("-H:-ParseOnce"); + } /** * This makes sure the Kerberos integration module is made available in case any library