解决分层打包后,报Could not find or load main class org.springframework.boot.loader.JarLauncher错误

发布时间 2023-12-22 15:09:39作者: Pursue`

解决分层打包后,报Could not find or load main class org.springframework.boot.loader.JarLauncher错误

发现问题

升级到springboot 3.2 后,之前的分层打包启动后会报一下错误

Error: Could not find or load main class org.springframework.boot.loader.JarLauncher
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.loader.JarLauncher

经Google搜索发现之前的org.springframework.boot.loader.JarLauncher已经被弃用, 需要修改对应的配置

Spring-Boot-3.2-Release-Notes#nested-jar-support
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.2-Release-Notes#nested-jar-support

相关问题 Relocate launcher classes to 'org.springframework.boot.loader.launch' package #37667
Error: Could not find or load main class org.springframework.boot.loader.PropertiesLauncher #38775

修改相关配置

  • 修改 docker-entrypoint.sh
    修改前

    修改后

  • 修改maven打包配置
    修改前

修改后