1. The local dependent jar package is introduced into the springboot project and packaged into the lib folder
Description: After downloading the third-party related jar package, the local jar is introduced into the project, the test environment is normal, and the error message on the packaging line is that the jar is found
Reason: It should be packaged into this directory in /WEB-INF/lib/xxx.jar :/WEB-INF/classes/lib/xxx.jar
2. Introduce local dependent jar packages
After introducing the jar package, add dependent coordinates in this pom.xml file, that is, add content
<dependencies>
<dependency>
<groupId>org.eclipse.paho.client.mqttv3_1.0.2_dms</groupId>
<artifactId>org.eclipse.paho.client.mqttv3_1.0.2_dms.jar</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>${pom.basedir}/src/main/resources/lib/org.eclipse.paho.client.mqttv3_1.0.2_dms.jar</systemPath>
</dependency>
</dependencies>
3. Packaged into the lib package
In the <build></build> tag of the pom, the following modifications need to be made, and the content will be added after the war package is added.
<build>
<!-- war的名称 -->
<finalName>mall-portal</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
<!-- 打war包 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<!-- 配置将第三方jar打进war包中,跟<packaging>war</packaging>配合 -->
<webResource>
<directory>${pom.basedir}/src/main/resources/lib/</directory>
<targetPath>WEB-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</webResource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>