官网教程: https://github.com/dsyer/spring-boot-thin-launcher
    原理; 将lib依赖全部分离出去

    1 pom文件添加

    1. <plugin>
    2. <groupId>org.springframework.boot</groupId>
    3. <artifactId>spring-boot-maven-plugin</artifactId>
    4. <dependencies>
    5. <dependency>
    6. <groupId>org.springframework.boot.experimental</groupId>
    7. <artifactId>spring-boot-thin-layout</artifactId>
    8. <version>1.0.25.RELEASE</version>
    9. </dependency>
    10. </dependencies>
    11. </plugin>

    2 正常打包即可,可以看到jar文件已经非常小了,因为排除了所有的lib依赖
    3 启动

    java -jar -Dthin.root=. -Dthin.dryrun=true -Dthin.repo=https://xxx/repository/maven/ xxx.jar
    
    #-Dthin.root    :指定repository仓库路径
    #-Dthin.dryrun:是否空运行,预热
    #-Dthin.repo    :指定repostory 下载的地址