gson-comments/graal-native-image-test
dependabot[bot] b209d8ecb2
Bump org.graalvm.buildtools:native-maven-plugin from 0.10.0 to 0.10.1 (#2633)
Bumps [org.graalvm.buildtools:native-maven-plugin](https://github.com/graalvm/native-build-tools) from 0.10.0 to 0.10.1.
- [Release notes](https://github.com/graalvm/native-build-tools/releases)
- [Commits](https://github.com/graalvm/native-build-tools/compare/0.10.0...0.10.1)

---
updated-dependencies:
- dependency-name: org.graalvm.buildtools:native-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-27 16:18:21 -08:00
..
src/test Formatting follow-up (#2540) 2023-11-14 15:09:54 -08:00
README.md Add integration test for GraalVM Native Image (#2466) 2023-08-13 08:44:00 -07:00
pom.xml Bump org.graalvm.buildtools:native-maven-plugin from 0.10.0 to 0.10.1 (#2633) 2024-02-27 16:18:21 -08:00

README.md

graal-native-image-test

This Maven module contains integration tests for using Gson in a GraalVM Native Image.

Execution requires using GraalVM as JDK, and can be quite resource intensive. Native Image tests are therefore not enabled by default and the tests are only executed as regular unit tests. To run Native Image tests, make sure your PATH and JAVA_HOME environment variables point to GraalVM and then run:

mvn clean test --activate-profiles native-image-test

Technically it would also be possible to directly configure Native Image test execution for the gson module instead of having this separate Maven module. However, maintaining the reflection metadata for the unit tests would be quite cumbersome and would hinder future changes to the gson unit tests because many of them just happen to use reflection, without all of them being relevant for Native Image testing.

Reflection metadata

Native Image creation requires configuring which class members are accessed using reflection, see the GraalVM documentation.

The file reflect-config.json contains this reflection metadata.

You can also run with -Dagent=true to let the Maven plugin automatically generate a metadata file, see the plugin documentation.