三、解决方法
步骤1: 正常编译JAR包,解压出lib文件夹
POM文件如下:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.johnnian.App</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugins>
<build>
进入项目根目录,执行命令:mvn clean install
将编译后的Jar包解压,拷贝 BOOT-INF 目录下的lib文件夹 到目标路径;
步骤2: 修改pom.xml配置,编译出不带 lib 文件夹的Jar包
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.johnnian.App</mainClass>
<layout>ZIP</layout>
<includes>
<include>
<groupId>nothing</groupId>
<artifactId>nothing</artifactId>
</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugins>
<build>
深圳网站建设www.sz886.com