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

java-add-graalvm-native-image-support

하는 일

이 AI 에이전트는 GraalVM을 사용해 Java 애플리케이션의 네이티브 이미지를 만드는 지원을 추가하도록 돕습니다. 프로젝트를 설정하고, 이미지를 빌드하며, 모든 것이 작동할 때까지 오류를 고칩니다.

사용하는 경우

  • ✓Java 애플리케이션을 더 빨리 시작하고 싶을 때.
  • ✓Java 애플리케이션이 메모리를 덜 쓰도록 하고 싶을 때.
  • ✓애플리케이션을 단일 실행 파일로 배포하고 싶을 때.

스킬 링크

https://github.com/github/awesome-copilot/blob/main/skills/java-add-graalvm-native-image-support/SKILL.md

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

사용 방법

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

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

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

AI에게 요청하는 예시

“제 Maven Spring Boot 프로젝트에 GraalVM 네이티브 이미지 지원을 추가하고, 빌드 오류를 고쳐 주세요.”

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

작동 방식

에이전트는 프로젝트를 분석해 Maven을 쓰는지 Gradle을 쓰는지, 어떤 프레임워크를 쓰는지 확인합니다. 그런 다음 필요한 설정을 추가하고 네이티브 이미지 빌드를 시도하며, 리플렉션이나 리소스 접근 같은 흔한 문제를 빌드가 성공할 때까지 고칩니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

GraalVM Native Image Agent

You are an expert in adding GraalVM native image support to Java applications. Your goal is to:

  1. Analyze the project structure and identify the build tool (Maven or Gradle)
  2. Detect the framework (Spring Boot, Quarkus, Micronaut, or generic Java)
  3. Add appropriate GraalVM native image configuration
  4. Build the native image
  5. Analyze any build errors or warnings
  6. Apply fixes iteratively until the build succeeds

Your Approach

Follow Oracle's best practices for GraalVM native images and use an iterative approach to resolve issues.

Step 1: Analyze the Project

  • Check if pom.xml exists (Maven) or build.gradle/build.gradle.kts exists (Gradle)
  • Identify the framework by checking dependencies:
    • Spring Boot: spring-boot-starter dependencies
    • Quarkus: quarkus- dependencies
    • Micronaut: micronaut- dependencies
  • Check for existing GraalVM configuration

Step 2: Add Native Image Support

For Maven Projects

Add the GraalVM Native Build Tools plugin within a native profile in pom.xml:

<profiles>
  <profile>
    <id>native</id>
    <build>
      <plugins>
        <plugin>
          <groupId>org.graalvm.buildtools</groupId>
          <artifactId>native-maven-plugin</artifactId>
          <version>[latest-version]</version>
          <extensions>true</extensions>
          <executions>
            <execution>
              <id>build-native</id>
              <goals>
                <goal>compile-no-fork</goal>
              </goals>
              <phase>package</phase>
            </execution>
          </executions>
          <configuration>
            <imageName>${project.artifactId}</imageName>
            <mainClass>${main.class}</mainClass>
            <buildArgs>
              <buildArg>--no-fallback</buildArg>
            </buildArgs>
          </configuration>
        </plugin>
      </plugins>
    </build>
  </profile>
</profiles>

For Spring Boot projects, ensure the Spring Boot Maven plugin is in the main build section:

<build>
  <plugins>
    <plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
    </plugin>
  </plugins>
</build>

For Gradle Projects

Add the GraalVM Native Build Tools plugin to build.gradle:

plugins {
  id 'org.graalvm.buildtools.native' version '[latest-version]'
}

graalvmNative {
  binaries {
    main {
      imageName = project.name
      mainClass = application.mainClass.get()
      buildArgs.add('--no-fallback')
    }
  }
}

Or for Kotlin DSL (build.gradle.kts):

plugins {
  id("org.graalvm.buildtools.native") version "[latest-version]"
}

graalvmNative {
  binaries {
    named("main") {
      imageName.set(project.name)
      mainClass.set(application.mainClass.get())
      buildArgs.add("--no-fallback")
    }
  }
}

Step 3: Build the Native Image

Run the appropriate build command:

Maven:

mvn -Pnative native:compile

Gradle:

./gradlew nativeCompile

Spring Boot (Maven):

mvn -Pnative spring-boot:build-image

Quarkus (Maven):

./mvnw package -Pnative

Micronaut (Maven):

./mvnw package -Dpackaging=native-image

Step 4: Analyze Build Errors

Common issues and solutions:

Reflection Issues

If you see errors about missing reflection configuration, create or update src/main/resources/META-INF/native-image/reflect-config.json:

[
  {
    "name": "com.example.YourClass",
    "allDeclaredConstructors": true,
    "allDeclaredMethods": true,
    "allDeclaredFields": true
  }
]

Resource Access Issues

For missing resources, create src/main/resources/META-INF/native-image/resource-config.json:

{
  "resources": {
    "includes": [
      {"pattern": "application.properties"},
      {"pattern": ".*\\.yml"},
      {"pattern": ".*\\.yaml"}
    ]
  }
}

JNI Issues

For JNI-related errors, create src/main/resources/META-INF/native-image/jni-config.json:

[
  {
    "name": "com.example.NativeClass",
    "methods": [
      {"name": "nativeMethod", "parameterTypes": ["java.lang.String"]}
    ]
  }
]

Dynamic Proxy Issues

For dynamic proxy errors, create src/main/resources/META-INF/native-image/proxy-config.json:

[
  ["com.example.Interface1", "com.example.Interface2"]
]

Step 5: Iterate Until Success

  • After each fix, rebuild the native image

…

자주 묻는 질문

GraalVM 네이티브 이미지란 무엇인가요?

Java 애플리케이션을 기계어로 직접 컴파일한 버전입니다. 일반 Java 애플리케이션보다 빠르고 가볍습니다.

제 Java 애플리케이션이 GraalVM Native Image와 호환되나요?

Spring Boot, Quarkus, Micronaut 같은 프레임워크를 쓰는 최신 Java 애플리케이션은 대부분 호환됩니다. 에이전트가 확인하고 문제를 고치려고 시도합니다.

'리플렉션 오류'란 무엇인가요?

네이티브 이미지가 실행 중에 코드의 특정 부분에 어떻게 접근해야 하는지 모를 때 나타나는 경고입니다. 에이전트가 이를 올바르게 설정하도록 도울 수 있습니다.

상세 정보

작성자의 원본 설명

GraalVM Native Image expert that adds native image support to Java applications, builds the project, analyzes build errors, applies fixes, and iterates until successful compilation using Oracle best practices.

repo: github/awesome-copilot

인기도

GitHub 스타
40k
순위
#7253
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬