赞
踩
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.0.5:repackage (default) on project XX-manager: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:3.0.5:repackage failed: Unable to load the mojo 'repackage' in the plugin 'org.springframework.boot:spring-boot-maven-plugin:3.0.5' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: 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
ps:不涉及到Jenkis,如果是本地编译报错,也是这样解决处理。
2.原因
由于spring-boot-maven-plugin没有指定版本,Jenkis部署的时候自动获取最新版本,而最新版本的不兼容,导致的该问题,以下代码是历史代码:
-
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <configuration>
- <mainClass>com.XXXX.XXXX</mainClass>
- <fork>true</fork>
- <addResources>true</addResources>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>repackage</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
spring-boot-maven-plugin指定版本,查看了Jenkis的部署成功的日志,之前成功的获取的版本是“2.2.5.RELEASE”(可以根据需要尝试低版本的),将version设置为2.2.5.RELEASE就可以了。
Jenkis部署成功的日志:
[INFO] --- spring-boot-maven-plugin:2.2.5.RELEASE:repackage (default) @ XXXX ---
[INFO] Replacing main artifact with repackaged archive
修改的配置文件:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.2.5.RELEASE</version>
<configuration>
<mainClass>com.XXXX.XXXX</mainClass>
<fork>true</fork>
<addResources>true</addResources>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
这样问题就解决了,如果对您有帮助,记得点赞呀~
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。