मुख्य सामग्री पर जाएँ
Skillpedia
API और सर्वर (backend)22k · #10357

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 पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/skills/build-native-image-maven/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

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_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 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

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills