Skip to content

Move GraalVM config from current *.json config files to reachability-metadata.json starting with GraalVM / Mandrel for JDK 25 #41016

@zakkak

Description

@zakkak

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:

  1. it requires invoking native-image --version each time we need the version
  2. 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)

Sub-issues

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions