1. 在resources文件夹下新建文件夹,名称随意, 这里命名为jar文件夹
2. 将jar包放入该文件夹
3. 配置pom.xml
<dependency>
<groupId>com.test</groupId>
<artifactId>test</artifactId>
<version>2.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/jar/test.jar</systemPath>
</dependency>
groupId,artifactId,version可随便写
这时候在项目中运行是没问题了,但是使用命令mvn clean package打包之后BOOT-INF\lib里面并没有test.jar包,还需要pom文件中做如下配置:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>