1、pom文件配置
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <executable>true</executable> <mainClass> com.iasp.BasicStarter </mainClass> <!--只包含自己--> <includes> <include> <groupId>${groupId}</groupId> <artifactId>${artifactId}</artifactId> </include> </includes> <!--不包含哪些--> <!--<excludeGroupIds>--> <!--com.hundsun.jrescloud,--> <!--org.springframework.boot,--> <!--org.springframework--> <!--</excludeGroupIds>--> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin>
配置上述打包之后就会排除相应的jar包,使得由插件打成的Flat jar包大小变小,便于上传服务器发布,然后在启动项目时指定jar包路径-Dloader.path="../lib",这样就可以达到瘦身效果了
原文:https://www.cnblogs.com/kingsonfu/p/11431743.html