配置插件不使用任何依赖
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>cn.com.wenyl.bs.BSBootApplication</mainClass> <!-- 你的主类 -->
<executable>true</executable>
<layout>NONE</layout>
<includes>
<include>
<groupId>nothing</groupId>
<artifactId>nothing</artifactId>
</include>
</includes>
</configuration>
</plugin>
依赖包分离处理
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
打包好后目录下有jar包和lib目录
拷贝到服务器上执行启动命令
java -jar bs-boot-system-1.0-SNAPSHOT.jar -Dloader.path ./lib
这里-Dloader.path指向自己的lib目录即可