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.

referencesmicronaut.md

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

Micronaut native images

Micronaut performs ahead-of-time processing at compile time, so most native image metadata is generated automatically.

Commands

  • Maven: ./mvnw package -Dpackaging=native-image (container build: ./mvnw package -Dpackaging=docker-native)
  • Gradle: ./gradlew nativeCompile (container: ./gradlew dockerBuildNative)
  • Native tests: ./mvnw -Pnative test or ./gradlew nativeTest, depending on the generated project

Check the generated project's profiles/tasks and use a compatible GraalVM JDK. In the standard Micronaut parent POM (4.10.0 and 5.0.2), graalvm configures annotation processing; native binds the Native Build Tools native-test goals. A successful -Pgraalvm test alone is not evidence that native tests ran.

The Micronaut Maven/Gradle plugins configure the Native Build Tools plugin for you; do not add it again.

Reflection and resources

  1. Bean introspection: @Introspected for POJOs avoids reflection:

    @Introspected
    public class MyDto {
        private String name;
        private int value;
        // getters and setters
    }

    Or @Serdeable for Micronaut Serialization types.

  2. Reflection: @ReflectionConfig(type = MyClass.class, accessType = TypeHint.AccessType.ALL_DECLARED_CONSTRUCTORS) (both from io.micronaut.core.annotation; accessType takes TypeHint.AccessType[]) on a configuration class, or @TypeHint(MyClass.class) for the default access.

  3. Resources: Micronaut has no resource annotation; list patterns in META-INF/native-image/<group>/<artifact>/resource-config.json (or the unified reachability-metadata.json), or use the Native Build Tools resource detection settings.

  4. Gradle build arguments (only if needed):

    graalvmNative {
        binaries {
            main {
                buildArgs.add("--initialize-at-run-time=io.netty")
            }
        }
    }

    Micronaut already sets sensible initialization defaults; add flags only for a specific failing class. Avoid --report-unsupported-elements-at-runtime outside diagnosis.

Tips

  • Use Micronaut's compile-time features (@Introspected, @Serdeable, @Client interfaces) rather than runtime reflection.
  • Netty and HTTP client tuning is a runtime concern; do not change netty.default.allocator settings to fix native build errors.
  • Check whether a compatible Micronaut module update supplies metadata before adding it manually; propose any upgrade for user approval, preserve managed versions, and rerun the JVM baseline afterwards.

Guide: https://docs.micronaut.io/latest/guide/#graal

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.