# SpringBoot项目瘦身部署-分离lib
# 1.生成lib包
pom.xml同级执行
mvn dependency:copy-dependencies -DoutputDirectory=lib -DincludeScope=runtime
# 2.修改pom.xml
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!-- 加上下面这些 -->
<mainClass>com.example.demo.APP</mainClass>
<layout>ZIP</layout>
<includes>
<include>
<groupId>nothing</groupId>
<artifactId>nothing</artifactId>
</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 3.打包
mvn clean install
# 4.运行
把lib文件夹和jar包同目录
java -Dloader.path=lib -jar demo.jar