XXX has been compiled by a more recent version of the Java Runtime (class file version 61.0)

发布时间 2023-08-28 22:45:54作者: 秋夜雨巷

maven版本未指定导致编译失败问题

Execution default of goal org.springframework.boot:spring-boot-maven-plugin:3.1.3:repackage faile
d: Unable to load the mojo 'repackage' in the plugin 'org.springframework.boot:spring-boot-maven-plugin:3.1.3' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/springfra
mework/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
image

解决方案

指定version即可

<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<version>2.3.5.RELEASE</version>
				<executions>
					<execution>
						<goals>
							<goal>repackage</goal>
						</goals>
					</execution>
				</executions>
			</plugin>