build-native-image-gradle
What it does
This skill helps Java developers turn their Gradle projects into native programs that start quickly. It is for teams who want lighter, faster Java applications.
When to use it
- ✓When you want to build a Java application as a GraalVM native image with Gradle.
- ✓When a native image build fails with class initialization, linking or memory errors.
- ✓When you need to set up native tests or fix missing reflection metadata for a Gradle project.
Skill link
https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/skills/build-native-image-gradle/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Set up my Gradle Java app to build as a GraalVM native image and run the native tests.”
5 new skills a week. 1 minute to read.
How it works
It adds the GraalVM Native Build Tools plugin to your build file, then runs the native compile, run and test tasks. It uses a GraalVM JDK set as JAVA_HOME and points to guides for known build problems.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Gradle Native Image Build
Prerequisites
- Set
JAVA_HOMEto a GraalVM JDK installation so Gradle Native Build Tools can findnative-image. - Do not require
GRAALVM_HOMEin the normal case. Only mention it if the user already relies on it or their environment needs an explicit override. - Apply the
application,java-library, orjavaplugin along withorg.graalvm.buildtools.native.
Plugin Setup
Groovy DSL:
plugins {
id 'application'
id 'org.graalvm.buildtools.native' version '0.11.1'
}
Kotlin DSL:
plugins {
application
id("org.graalvm.buildtools.native") version "0.11.1"
}
Build and Run
./gradlew nativeCompile # Build to build/native/nativeCompile/
./gradlew nativeRun # Build and run the native executable
./gradlew nativeTest # Build and run JUnit tests as a native image
Build or Runtime Failures
If the build fails with class initialization, linking errors, memory issues, or the binary behaves incorrectly at runtime, see references/native-image-build-gradle-options.md.
Native Testing
If nativeTest fails or you need to configure native JUnit tests or custom test suites, see references/testing.md.
Missing Reachability Metadata
If a build or runtime error reports missing reflection, resource, serialization, or JNI registrations, see references/reachability-metadata.md.
Reference Files
| Topic | File |
|---|---|
| DSL options and build arguments | references/native-image-build-gradle-options.md |
| Missing reachability metadata | references/reachability-metadata.md |
| Native testing | references/testing.md |
FAQ
What Java install does it need?
A GraalVM JDK, set as JAVA_HOME, so the native-image tool can be found.
Does it work with Maven too?
Gradle is covered by this skill, and Maven has its own separate skill.
Does it help with missing metadata?
Yes. It covers missing reflection and resource metadata errors.
Details
Original description by the author
Build GraalVM native images using Gradle Native Build Tools. Use this skill to build Java applications with Gradle, configure native-image build.gradle settings, or resolve build or runtime issues.
repo: oracle/graal
Popularity
- GitHub stars
- 22k
- Ranking position
- #10356
- License
- —
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
build-native-image-maven
22kHelps your agent build Java apps into GraalVM native images with Maven, configure the pom.xml, run native tests and fix build issues.
building-native-image
22kTeaches your agent to turn Java programs into fast standalone apps with GraalVM Native Image, and to fix common build or runtime errors.
Similar skills
api-connector-builder
280kHas your agent build new API connections following the existing pattern. Use when you need to add one more integration without creating a new way of doing things.
api-design
280kHelps your agent design REST APIs following best practices. It's useful for defining how APIs communicate, how errors are shown, and how to organize data.
backend-patterns
280kHelps your agent with server-side architecture patterns and database optimization. It's useful for building or reviewing code that runs on the server.