最好的引入本地依赖的方式是搭建自己的maven私服,这里介绍如何在项目中直接引入本地jar
一、 复制本地jar到项目
- 新建目录resources/lib
- 将需要的jar包放入到该目录中
二、mave中增加依赖
<dependency>
<groupId>{{依据实际项目}}r</groupId>
<artifactId>{{依据实际项目}}</artifactId>
<version>1.0.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/{{依据实际项目}}r</systemPath>
</dependency>
三、build中引入resources
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
#这个必须有
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.jar</include>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>