SpringBoot快速引入第三方jar包


工作中,我们常会用到第三方jar包,而这些jar包往往在maven仓库是搜不到的,下面推荐一种简单、快速的引入第三方依赖的方法:

比如第三方jar包在lib文件夹下,对pom.xml的配置如下:

标签里面引入第三方jar包的依赖
pom.basedir指的是pom文件所在的目录,
systemPath指的是第三方jar包所在路径。
<dependency>
        <groupId>com.abcgroupId>
        <artifactId>cryptokitartifactId>
        <version>1.0version>
        <scope>systemscope>
        <systemPath>${pom.basedir}/lib/cryptokit-1.0.jarsystemPath>
 dependency>

还必须修改标签里面的maven plugin,增加includeSystemScope属性并设置为true

<plugin>
     <groupId>org.springframework.bootgroupId>
     <artifactId>spring-boot-maven-pluginartifactId>
     <configuration>
           <includeSystemScope>trueincludeSystemScope>
      configuration>
plugin>

通过以上的方式,就能使用maven将springboot项目打成一个jar包的时候引入第三方jar了,比弄私服,本地仓库省事、方便