SpringBoot Maven RepackageMojo 打包失败原因

本文介绍了在升级到Spring Boot 3.0后,由于最低JDK版本提升至17,如何通过调整`spring-boot-maven-plugin`的版本来解决Maven打包时的编译错误。解决方案是在`pom.xml`中明确指定插件的版本为2.7.3。

maven 打包 提示:
org/springframework/boot/maven/RepackageMojo has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

原因

SpringBoot 3.0 发布,SpringBoot 3.0 最低支持 jdk17,所以这个 maven plugin 使用的也是最低 17 版本编译的

解决方案

pom 文件中指定 maven plugin 版本

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
               <version>2.7.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    ```
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值