Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file

maven打包报错

org/ springframework /boot / maven/BuildInfoMojo hasbeen copiled 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

java 运行时的最新版本(类文件版本 61.0)编译的,该版本的 Java 运行时只识别 52.0 以下的类文件版本
原因:
根据 Spring Boot with spring version 2.5.7 fails repackage with jdk 1.8 这篇文章中下面的说法
在这里插入图片描述
目标org.springframework.boot:spring-boot-maven插件:3.0.0-M1:重新打包失败:由于API不兼容,无法在插件“org.springfframework.boot:spring-boot maven插件:3.0.0-M1”中加载mojo“重新打包”:org.codehaus.plexus.component.repository.exeption.ComponentLookupException:org/springframework/boot/maven/RepackageMojo已由较新版本的Java Runtime(类文件版本61.0),此版本的Java Runtime仅识别52.0以下的类文件版本

在你的 pom 中使用的“spring boot maven插件”版本。如果没指定spring-boot-maven-plugin 的版本,就会拿取最新的版本打包,但是目前高版本的为未必适合1.8的jdk,如果它确实是您想要用于 spring boot 项目的版本。
为了解决这个问题,就必须明确指定spring-boot-maven-plugin的版本

解决方式:指定版本号

<plugin>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-maven-plugin</artifactId>
	<!--指定版本号 -->
	<version>2.7.1</version>
	<configuration>
		<includeSystemScope>true</includeSystemScope>
	</configuration>
	<executions>
		<execution>
			<goals>
				<goal>repackage</goal>
				<goal>build-info</goal>
			</goals>
		</execution>
	</executions>
</plugin>
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值