Search code examples
spring-bootmavengraalvmspring-native

spring-boot-maven-plugin:3.2.0:process-aot Get stuck


run command: mvn -Pnative native:compile but execute here spring-boot-maven-plugin:3.2.0:process-aot Get stuck try Ctrl+C after is work

https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html#native-image.whats-next

pom.xml:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.2.0</version>
    <relativePath/>
</parent>

<dependencies>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
    </dependency>

    <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>
    </dependency>

</dependencies>

<profiles>
    <profile>
        <id>native</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.graalvm.buildtools</groupId>
                    <artifactId>native-maven-plugin</artifactId>
                    <configuration>
                        <imageName>${project.artifactId}</imageName>
                        <mainClass>com.example.techtest.TechTestApplication</mainClass>
                        <skipNativeTests>true</skipNativeTests>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

Execution information:

[INFO] --- spring-boot-maven-plugin:3.2.0:process-aot (process-aot) @ tech-spring-boot- 
starter ---
c.example.techtest.TechTestApplication   : Starting TechTestApplication using Java 
21.0.1 with PID 20128 (D:\WorkSpace\project\tech-test\target\classes started by 86188 in 
D:\WorkSpace\project\tech-test)
2023-12-28T16:28:51.406+08:00  INFO 20128 --- [           main] 
c.example.techtest.TechTestApplication   : The following 1 profile is active: "native"

Solution

  • spring.main.keep-alive Change the configuration to false is work.

    This has been fixed in springboot 3.2.1