将lib中的第三方包引入打入项目jar包中
有些情况公共仓库没有第三方依赖包,此时我们除了将该包维护到私有仓库外,还可以选择将第三方的jar包维护到项目的lib目录下,然后在打包时,一起打入项目的jar包中。
一.新建一个lib文件夹
在项目的根目录或者模块的目录下新建一个lib文件夹,,放入所需的第三方jar包。
二.pom文件配置读取lib中的jar包
pom文件添加配置如下:
<dependency>
<groupId>com.xxx</groupId>
<artifactId>third</artifactId>
<!--system,类似provided,需要显式提供依赖的jar以后,Maven就不会在Repository中查找它-->
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/third.jar</systemPath>
<version>1.0.0</version>
</dependency>
三.在pom文件中添加如下插件配置
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
这样在打包时,就可以将第三方jar包一起打包到项目jar包中。