springboot项目中引入本地jar
一、代码引入
1.创建lib文件夹
在src同级目录下创建lib文件夹,并且将jar放置这个文件夹下
2.pom引入
<dependency>
<groupId>com.zg</groupId>
<artifactId>mongdb-plugin</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/api-plugin-mongo</systemPath>
</dependency>
groupId和artifactId和version随便写,scope作用范围是system,systemPath写当前文件路径
打包配置修改,新增configuration
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.4.RELEASE</version>
<executions>
<execution>
<goals>
<goal>build-info</goal>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>true</executable>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>