본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)22k · #10357

build-native-image-maven

하는 일

이 스킬은 Java 개발자가 Maven 프로젝트를 빠르게 시작되는 네이티브 프로그램으로 바꾸도록 돕습니다. 더 가볍고 빠른 Java 앱을 원하는 팀을 위한 스킬입니다.

사용하는 경우

  • ✓Maven으로 Java 앱을 GraalVM 네이티브 이미지로 빌드하고 싶을 때.
  • ✓pom.xml 파일에 native-maven-plugin을 추가해야 할 때.
  • ✓네이티브 이미지 빌드가 실패해 메타데이터를 수집하거나 런타임 문제를 고쳐야 할 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/skills/build-native-image-maven/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“Java 앱을 네이티브 이미지로 빌드할 수 있도록 Maven pom.xml에 native 프로필을 추가해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

pom.xml에 native-maven-plugin이 있는 native 프로필을 추가하고, Maven wrapper로 빌드합니다. 플러그인이 native-image 도구를 찾도록 JAVA_HOME을 GraalVM JDK로 설정합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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
자주 묻는 질문

어떤 Maven 버전이 필요한가요?

Maven 3.6 이상입니다.

GRAALVM_HOME을 쓰나요?

보통 쓰지 않습니다. JAVA_HOME에 의존하며, 이미 쓰고 있는 경우에만 GRAALVM_HOME을 언급합니다.

네이티브 테스트를 실행할 수 있나요?

네. 네이티브 JUnit 테스트를 위한 test-native 실행을 설정합니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
22k
순위
#10357
라이선스
—
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬