Index of every page on this site: llms.txt
All skills
github avatar

/java-add-graalvm-native-image-support

@f10fdb8 official
by githubgithub/awesome-copilot42k stars
5,426
Run it yourself

GraalVM Native Image skill for Spring Boot, Micronaut and plain Java: detects the build tool and framework, adds native image support, builds the executable, analyzes errors, and iterates until the native build succeeds and the binary runs correctly. For Quarkus projects it only dispatches to the quarkus-native-and-container skill.

Use this Skill: https://skilld.dev/gh/github/awesome-copilot/java-add-graalvm-native-image-support

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencestroubleshooting.md

≈853 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Common native image errors and fixes

Symptom Likely cause Fix
ClassNotFoundException, NoSuchMethodException, NoSuchFieldException at runtime missing reflection metadata tracing agent; framework hints; reflect-config.json
MissingReflectionRegistrationError same, reported precisely register the named type/member
Resource null / FileNotFoundException for classpath files resource not included resource-config.json pattern; framework resource setting
Proxy class defined by interfaces [...] not found missing proxy metadata proxy-config.json / framework hints
Classes that should be initialized at run time got initialized during image building build-time init of a class holding runtime state (random, sockets, threads, system properties) --initialize-at-run-time=<class>
Object of type X was found in the image heap (random, threads, file handles) build-time init stored non-image-safe state move init to run time for the owning class
Detected a started Thread in the image heap thread started in a static initializer defer to run time
UnsatisfiedLinkError missing JNI/native lib jni-config.json; ship or link the native library
Unsupported features in ... / Discovered unresolved type during parsing an optional dependency is missing or the library is unsupported add the dependency; upgrade the library; check the reachability metadata repository
Serialization errors (java.io.Serializable) missing serialization metadata serialization-config.json / framework hints
Out of memory during build native build needs several GB raise container/CI memory; -J-Xmx<size> as a build arg; close other processes
Build very slow normal for full optimization -O b for dev only; use CI caching; build only in a profile
Binary behaves differently from JVM build-time initialization, missing metadata, no dynamic class loading native tests; tracing agent over the full test suite
Large binary many dependencies review dependencies; -Os; on Oracle GraalVM check --emit build-report (not available in Community Edition)
Dynamic class loading, Class.forName on unknown names, agents, MethodHandles tricks not supported in native images refactor to static registration

Diagnosis workflow

  1. Run the build with -H:+ReportExceptionStackTraces for the full error.
  2. On Oracle GraalVM, add --emit build-report to see what pulled classes in (Build Report is not available in GraalVM Community Edition; use the standard build output there).
  3. For runtime errors, run the same scenario with the tracing agent on the JVM and diff the output against your metadata.
  4. On Oracle GraalVM, use the build report to find which dependency causes the size or initialization problem.

Cautions

  • Dependency/framework upgrades and CI or runner changes require user approval even when suggested above; preserve managed versions and rerun the JVM baseline after dependency changes.
  • --initialize-at-build-time is an optimization with risks; apply it to named classes, not broad packages, unless the framework documents it.
  • --report-unsupported-elements-at-runtime only delays failures; use it for diagnosis, not as a fix.
  • Native binaries are platform-specific; build on the target OS/architecture (or in a matching container).

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning1mo5 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    This skill provides standard and safe instructions for adding GraalVM Native Image support to Java projects. It correctly identifies project frameworks, suggests official build tools, and follows security best practices such as requesting user consent before modifying configurations or dependencies.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

  • Runlayer9mo

    1/1 file flagged

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at f10fdb8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 days ago.

Activeupdated last month
  • graalvm
  • native-image
  • java
  • maven
  • gradle
  • spring-boot
  • quarkus
  • micronaut
  • aot
  • compilation

README badge

README badge for github/awesome-copilot/java-add-graalvm-native-image-support

Adds GraalVM Native Image support to Java applications by detecting the build tool and framework, configuring native image plugins, building iteratively, and applying fixes for reflection, resources, JNI, and proxy issues. Targets Maven and Gradle projects using Spring Boot, Quarkus, Micronaut, or generic Java with framework-specific best practices.

Generated from the current SKILL.md.

Does this skill work with Spring Boot, Quarkus, and Micronaut?
Yes. The skill detects and handles all three frameworks with framework-specific configuration, including Spring AOT RuntimeHints, Quarkus @RegisterForReflection, and Micronaut @Introspected annotations.
What build tools does this skill support?
Maven and Gradle. The skill detects which tool your project uses and applies the native-maven-plugin or org.graalvm.buildtools.native plugin accordingly.
Does this skill automatically resolve native image build errors?
Yes. The skill iteratively analyzes build failures, generates or updates reflection, resource, JNI, and proxy configuration files, and rebuilds until compilation succeeds. It can also run the GraalVM tracing agent to auto-discover configuration requirements.
What happens if my project has custom reflection or JNI requirements?
The skill creates or updates META-INF/native-image config files (reflect-config.json, jni-config.json, resource-config.json, proxy-config.json) to handle them, and for Spring Boot projects can register custom RuntimeHints.

Generated from the current SKILL.md. These answers refresh after source changes.