Description
Starting with GraalVM / Mandrel for JDK 23 (24.1) the proxy-config.json file will be deprecated. Instead, proxy registrations should be moved to reachability-metadata.json, see oracle/graal#9048
Not doing so results in a warning:
Warning: Option 'DynamicProxyConfigurationResources' is deprecated and might be removed in a future release. Please refer to the GraalVM release notes.
Implementation ideas
Ideally we should only generate proxy-config.json when using GraalVM / Mandrel < 24.1 and reachability-metadata.json when using >= 24.1, however the configuration files are created when building the jar file, i.e. before identifying the GraalVM / Mandrel version.
In such cases we use the following pattern:
|
final GraalVM.Version graalVMVersion = nativeImageRunner.getBuildRunner().getGraalVMVersion(); |
|
if (graalVMVersion.compareTo(GraalVM.Version.VERSION_23_0_0) >= 0) { |
|
// See https://github.com/oracle/graal/issues/4921 |
|
try (DirectoryStream<Path> sharedLibs = Files.newDirectoryStream(nativeImage.getPath().getParent(), |
|
"*.{so,dll}")) { |
|
sharedLibs.forEach(src -> { |
|
try { |
|
// In this use case, we can force all libs to be non-executable. |
|
addZipEntry(zip, src, src.getFileName().toString(), 0644); |
|
} catch (Exception e) { |
|
throw new RuntimeException(e); |
|
} |
|
}); |
|
} catch (IOException e) { |
|
log.errorf("Could not list files in directory %s. Continuing. Error: %s", nativeImage.getPath().getParent(), |
|
e); |
|
} |
|
} |
Which unfortunately is not ideal as:
- it requires invoking
native-image --version each time we need the version
- it might run on a different step than the actual native build (see https://quarkus.io/guides/building-native-image#separating-java-and-native-image-compilation)
Description
Starting with GraalVM / Mandrel for JDK 23 (24.1) the
proxy-config.jsonfile will be deprecated. Instead, proxy registrations should be moved toreachability-metadata.json, see oracle/graal#9048Not doing so results in a warning:
Implementation ideas
Ideally we should only generate
proxy-config.jsonwhen using GraalVM / Mandrel < 24.1 andreachability-metadata.jsonwhen using >= 24.1, however the configuration files are created when building the jar file, i.e. before identifying the GraalVM / Mandrel version.In such cases we use the following pattern:
quarkus/extensions/amazon-lambda/common-deployment/src/main/java/io/quarkus/amazon/lambda/deployment/FunctionZipProcessor.java
Lines 146 to 163 in 20d3c9d
Which unfortunately is not ideal as:
native-image --versioneach time we need the version