Problem with native executable in spring boot 3.2.0

200 views Asked by At

Creating a spring-boot application to produce native image using:- native-image 21.0.1 2023-10-17 GraalVM Runtime Environment Oracle GraalVM 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19)

Below is maven dependency

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.2.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.java4raju</groupId>
    <artifactId>springvirtualnativegraalvm</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>SpringVirtualNativeGraalVM</name>
    <description>Demo project for GraalVm</description>
    <properties>
        <java.version>21</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.graalvm.buildtools</groupId>
                <artifactId>native-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
    
    

While using the command:- mvnw -Pnative native:compile I am getting the error:-

Error: Failed to automatically set up Windows build environment.
Please make sure that Visual Studio 2022 version 17.1.0 or later is installed on your system. You can download it at https://visualstudio.microsoft.com/d
ownloads/. If this error persists, please try and run GraalVM Native Image in an x64 Native Tools Command Prompt or file a ticket.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  10.788 s
[INFO] Finished at: 2023-12-15T22:57:27+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.graalvm.buildtools:native-maven-plugin:0.9.28:compile (default-cli) on project springvirtualnativegraalvm: Execution o
f C:\Program Files\Java\graalvm-jdk-21.0.1+12.1\bin\native-image.cmd @target\tmp\native-image-15258589517628325859.args returned non-zero result -> [Help
 1]

Please note I have already installed :-

**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.8.3
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

//Please Note I am trying to run in wondow machine   
0

There are 0 answers