Saltar al contenido
Skillpedia
APIs y servidores (backend)22 mil · #10357

build-native-image-maven

Qué hace

Esta skill ayuda a los desarrolladores de Java a convertir sus proyectos de Maven en programas nativos que arrancan rápido. Es para equipos que quieren aplicaciones Java más ligeras y rápidas.

Cuándo usarla

  • ✓Cuando quieres compilar una aplicación Java como imagen nativa de GraalVM con Maven.
  • ✓Cuando necesitas añadir native-maven-plugin a un archivo pom.xml.
  • ✓Cuando una compilación de imagen nativa falla y necesitas ayuda para recoger metadatos o corregir problemas de ejecución.

Link de la skill

https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/skills/build-native-image-maven/SKILL.md

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/skills/build-native-image-maven/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“Añade un perfil nativo a mi pom.xml de Maven para poder compilar mi app Java como imagen nativa.”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

Añade un perfil native con native-maven-plugin al pom.xml y después compila con el wrapper de Maven. Define JAVA_HOME con un JDK de GraalVM para que el plugin encuentre la herramienta native-image.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de GitHub.

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.

Missing Reachability Metadata

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

Native Testing

For nativeTest failures or setting up native JUnit tests, see references/testing.md.

Reference Files

Topic File
Plugin configuration options references/maven-plugin-options.md
Missing reachability metadata references/reachability-metadata.md
Native testing references/testing.md
Preguntas frecuentes

¿Qué versión de Maven hace falta?

Maven 3.6 o posterior.

¿Usa GRAALVM_HOME?

Normalmente no. Se basa en JAVA_HOME, y menciona GRAALVM_HOME solo si ya lo usas.

¿Puede ejecutar pruebas nativas?

Sí. Configura una ejecución test-native para las pruebas nativas de JUnit.

Detalles

Descripción original del autor

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.

repo: oracle/graal

Popularidad

Estrellas en GitHub
22 mil
Posición en el ranking
#10357
Licencia
—
Actualizada
2/11/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas