SpringBoot maven 项目只打包自己的代码
通用工具模块不必要完整的打包,而是只需要在打包的时候保留自己编写的代码
- 添加依赖
<dependency> <!-- generate jar without third part jars --> <groupId>org.springframework.boot.experimental</groupId> <artifactId>spring-boot-thin-layout</artifactId> <version>1.0.23.RELEASE</version> </dependency>
- 添加插件配置
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <dependencies> <dependency> <!-- generate jar without third part jars --> <groupId>org.springframework.boot.experimental</groupId> <artifactId>spring-boot-thin-layout</artifactId> <version>1.0.23.RELEASE</version> </dependency> </dependencies> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin>
重新打包后就会发现所有的依赖jar包都不存在了