build-native-image-maven
यह क्या करती है
यह स्किल Java डेवलपर को उनके Maven प्रोजेक्ट को जल्दी शुरू होने वाले native प्रोग्राम में बदलने में मदद करती है। यह उन टीमों के लिए है जो हल्के और तेज़ Java ऐप्स चाहती हैं।
कब इस्तेमाल करें
- ✓जब आप Maven से Java ऐप को GraalVM native image के रूप में बनाना चाहते हों।
- ✓जब आपको pom.xml फ़ाइल में native-maven-plugin जोड़ना हो।
- ✓जब native image build फ़ेल हो और metadata इकट्ठा करने या runtime समस्या ठीक करने में मदद चाहिए।
Skill का लिंक
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 में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरी Maven pom.xml फ़ाइल में native profile जोड़िए, ताकि मैं अपने Java ऐप को native image के रूप में बना सकूँ।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह pom.xml में native-maven-plugin वाला native profile जोड़ती है, फिर Maven wrapper से build करती है। यह JAVA_HOME को GraalVM JDK पर सेट करती है, ताकि plugin native-image टूल ढूँढ सके।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Maven Native Image Build
Prerequisites
- Set
JAVA_HOMEto a GraalVM JDK installation so the plugin 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. - 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 version चाहिए?
Maven 3.6 या उसके बाद का।
क्या यह GRAALVM_HOME इस्तेमाल करती है?
आमतौर पर नहीं। यह JAVA_HOME पर निर्भर करती है, और GRAALVM_HOME का ज़िक्र केवल तब करती है जब आप उसे पहले से इस्तेमाल करते हों।
क्या यह native tests चला सकती है?
हाँ। यह native JUnit tests के लिए test-native execution सेट करती है।
जानकारी
लेखक का मूल विवरण
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
- लाइसेंस
- —
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
build-native-image-gradle
22kआपके एजेंट को Gradle से Java ऐप्स को तेज़ GraalVM native images में बनाने में मदद करती है, और आम build या runtime समस्याएँ ठीक करती है।
building-native-image
22kआपके एजेंट को GraalVM Native Image से Java प्रोग्राम को तेज़ स्टैंडअलोन ऐप में बदलना सिखाती है, और आम build या runtime त्रुटियाँ ठीक करना भी।
मिलती-जुलती skills
api-connector-builder
280kयह आपके एजेंट को मौजूदा pattern के हिसाब से नए API connections बनाने देता है। जब बिना कोई नया तरीका बनाए एक और integration जोड़ना हो, तब इसका इस्तेमाल करें।
api-design
280kयह आपके एजेंट को best practices के हिसाब से REST APIs डिज़ाइन करने में मदद करता है। यह तय करने में काम आता है कि APIs आपस में कैसे बात करें, errors कैसे दिखें, और data को कैसे व्यवस्थित करें।
backend-patterns
280kआपके एजेंट को server-side architecture patterns और database optimization में मदद करता है। server पर चलने वाला code बनाने या review करने के लिए उपयोगी है।