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 035abc1f08a469..ad81ca018cf0d6 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 @@ -720,6 +720,11 @@ public NativeImageInvokerInfo build() { nativeImageArgs.add(excludeConfig.getResourceName()); } + // Work around https://github.com/quarkusio/quarkus/issues/21372 + if (graalVMVersion.is(GraalVM.Version.VERSION_21_3_0) && graalVMVersion.isJava17()) { + nativeImageArgs.add("-J--add-exports=java.management/sun.management=ALL-UNNAMED"); + } + nativeImageArgs.add(nativeImageName); //Make sure to have the -jar as last one, as it otherwise breaks "--exclude-config"