分为两种情况
一、打war包的情况
引入依赖
<dependency>
<groupId>com.xxxx</groupId>
<artifactId>xxxxx</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/xxxxx.jar</systemPath>
</dependency>
org.apache.maven.plugins 增加以下配置
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>${basedir}\lib</directory>
<targetPath>WEB-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
二、打jar包
引入依赖
<dependency>
<groupId>com.xxxx</groupId>
<artifactId>xxxx</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/xxxx.jar</systemPath>
</dependency>
org.springframework.boot增加includeSystemScope配置
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<!-- 增加此行,可以解决打包时,找不到jar包的问题-->
<addResources>true</addResources>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
clean重新打包即可