1. 问题: spring-boot项目,默认生成的pom使用spring-boot-maven-plugin打包,会把所有依赖项都打进jar文件中,在调试阶段需要频繁传输jar包时很痛苦。
2. 查找:上网搜索”maven 打包 依赖分离”等关键字,多数文章使用了maven-jar-plugin或其他插件,把spring-boot-maven-plugin替换掉了,例如:https://www.iteye.com/blog/icw-zy-2380977
不说会不会有什么影响,单纯就觉得不完美 -- 自动生成的spring-boot-maven-plugin就真的不能用了么?
3.梳理:
先看spring-boot-maven-plugin官文 [https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/htmlsingle ],其中有一节
5.3.5. Dependency Exclusion
By default, both the
repackage
and therun
goals will include anyprovided
dependencies that are defined in the project. A Spring Boot project should considerprovided
dependencies as "container" dependencies that are required to run the application.Some of these dependencies may not be required at all and should be excluded from the executable jar. For consistency, they should not be present either when running the application.