zl程序教程

您现在的位置是:首页 >  后端

当前栏目

Spring Boot 项目打包问题集锦: jar依赖多出boot-inf 文件夹问题/多环境动态打包/缺少BOOT-INF目录问题等...

2023-09-14 09:07:23 时间

Spring Boot 项目打包 boot-inf 文件夹的问题

spring-boot maven打包,一般pom.xml文件里会加

<plugin>

    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-maven-plugin</artifactId>

</plugin>

这样打的jar里会多一个目录BOOT-INF。

引起问题: 程序包不存在。

解决办法: 如果A子模块包依赖了B子模块包,在B子模块的pom文件,加入 configuration.skip = true

<plugin>

    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-maven-plugin</artifactId>

    <configuration>

        <skip>true</skip>

    </configuration>

</plugin>

Spring Boot Maven插件打包后,包内没有BOOT-INF目录

使用maven插件打包后,发现包很小100来kb,显然是不对,包内缺少BOOT-INF目录