Skip to content
Development
Skill

/build-native-image-maven

Build GraalVM native images using the native-maven-plugin (org.graalvm.buildtools). Use this skill to build Java applications with Maven, configure pom.xml native image settings, run native tests, collect metadata, or resolve build or runtime issues.

From plugin
graal
22k4 skills

Claude Code

$ npx -y skills add oracle/graal --skill build-native-image-maven --agent claude-code

SKILL.md

build-native-image-maven.SKILL.md
name: build-native-image-maven
description: Build GraalVM native images using the native-maven-plugin (org.graalvm.buildtools). Use this skill to build Java applications with Maven, configure pom.xml native image settings, run native tests, collect metadata, or resolve build or runtime issues.

Maven Native Image Build

Prerequisites

  • Set `JAVA_HOME` to a GraalVM JDK installation so the plugin can find `native-image`.
  • Do not require `GRAALVM_HOME` in the normal case. Only mention it if the user already relies on it or their environment needs an explicit override.
  • Use Maven 3.6+.

Plugin Setup

Add the following to your `pom.xml` inside a `native` profile:

<profiles>
  <profile>
    <id>native</id>
    <build>
      <plugins>
        <plugin>
          <groupId>org.graalvm.buildtools</groupId>
          <artifactId>native-maven-plugin</artifactId>
          <version>0.11.1</version>
          <extensions>true</extensions>
          <executions>
            <execution>
              <id>build-native</id>
              <goals>
                <goal>compile-no-fork</goal>
              </goals>
              <phase>package</phase>
            </execution>
            <execution>
              <id>test-native</id>
              <goals>
                <goal>test</goal>
              </goals>
              <phase>test</phase>
            </execution>
          </executions>
          <configuration>
            <mainClass>org.example.Main</mainClass>
          </configuration>
        </plugin>
      </plugins>
    </build>
  </profile>
</profiles>

Build and Run

./mvnw -Pnative package                    # Build native image โ†’ target/<imageName>
./target/myapp                             # Run the native executable
./mvnw -Pnative test                       # Build and run JUnit tests as a native image
./mvnw -Pnative -DskipTests package        # Skip all tests
./mvnw -Pnative -DskipNativeTests package  # Run JVM tests only, skip native

Plugin Not Resolving or Activating

  • **"Could not resolve artifact"** โ€” Ensure `mavenCentral()` is in repositories and the version is correct.
  • **"Could not find goal 'compile-no-fork'"** โ€” Verify `<extensions>true</extensions>` is set on the plugin.
  • **Build runs without native compilation** โ€” Check you are activating the profile: `./mvnw -Pnative package`.

Build or Runtime Failures

For class initialization errors, linking issues, memory problems, or unexpected runtime behavior, see [references/maven-plugin-options.md](references/maven-plugin-options.md).

Missing Reachability Metadata

When native-image reports missing reflection, resources, serialization, or JNI entries, see [references/reachability-metadata.md](references/reachability-metadata.md).

Native Testing

For `nativeTest` failures or setting up native JUnit tests, see [references/testing.md](references/testing.md).

Reference Files

| Topic | File | |-------|------| | Plugin configuration options | [references/maven-plugin-options.md](references/maven-plugin-options.md) | | Missing reachability metadata | [references/reachability-metadata.md](references/reachability-metadata.md) | | Native testing | [references/testing.md](references/testing.md) |

Read more
@oracle
Ships withgraal

GraalVM compiles applications into native executables that start instantly, scale fast, and use fewer compute resources ๐Ÿš€

Stars on GitHub

Momentum

stars in total
21.8k
Star history of oracle/graal on GitHub, a chart by star-history.com

Other skills on graal.

build-native-image-gradle

build-native-image-graโ€ฆ

Build GraalVM native images using Gradle Native Build Tools. Use this skill to build Java applications with Gradle, configureโ€ฆ

@oracle@oracleInstall Skill
building-native-image

building-native-image

Build and troubleshoot GraalVM Native Image applications. Use this skill to build Java applications with GraalVM Native Image,โ€ฆ

@oracle@oracleInstall Skill
update-libcontainer

update-libcontainer

Reimport Native Image's vendored libcontainer from a newer JDK while preserving local adaptations in a reviewable commit stack.โ€ฆ

@oracle@oracleInstall Skill

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, orโ€ฆ

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills3w309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android โ€” semantic ARIA roles and labels,โ€ฆ

ecc3w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commitsโ€ฆ

react12d252k
@facebook@facebookInstall Skill

Questions about build-native-image-maven.

Which coding agents can use build-native-image-maven?
build-native-image-maven installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.