springboot打包出现Type not present

时间:2025-03-01 16:05:20
[INFO] --- spring-boot-maven-plugin:3.0.0:repackage (default) @ ex-flow-business ---
[WARNING] Error injecting:
: Type not present
    at (:147)
    at (:46)
    at (:48)
    at (:81)
    at (:53)
    at $(:65)
    at $(:115)
    at $(:133)
    at (:68)
    at (:63)
    at (:45)
    at $2$(:1016)
    at (:1092)
    at $(:1012)
    at .Guice4$(:162)
    at (:81)
    at (:51)
    at (:263)
    at (:255)
    at (:519)
    at (:121)
    at (:208)
    at (:154)
    at (:146)
    at (:117)
    at (:81)
    at (:51)
    at (:128)
    at (:309)
    at (:194)
    at (:107)
    at (:993)
    at (:345)
    at (:191)
    at .invoke0(Native Method)
    at (:62)
    at (:43)
    at (:498)
    at (:289)
    at (:229)
    at (:415)
    at (:356)
    at (:47)
Caused by: : 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
    at .defineClass1(Native Method)
    at (:756)
    at (:142)
    at (:473)
    at $100(:74)
    at $(:369)
    at $(:363)
    at (Native Method)
    at (:362)
    at (:401)
    at (:42)
    at (:271)
    at (:247)
    at (:239)
    at (:139)
    ... 42 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.423 s
[INFO] Finished at: 2022-11-25T20:03:09+08:00
[INFO] Final Memory: 82M/855M
项目在本地时可以正常启动的,但是打包就报错,经过分析得出,应该是打包依赖的问题,解决方法: 在pom文件中的build—>plugins---->plugin中添加spring-boot-maven-plugin依赖的版本号如下: