本文介绍: Maven pom.xml 添加本地jar包依赖以及打包方法

 1. 安装到本地仓库

mvn install:install-file -Dfile=D:XX.jar -DgroupId=XX -DartifactId=XX -Dversion=1.11 -Production -Dpackaging=jar

2.dependency中指定scope=”system”和本地jar包路径

(1)配置本地jar包依赖(systemPath指向本地jar包路径):

<dependency>
  <groupId>XX</groupId>
  <artifactId>XX</artifactId>
  <version>1.11</version>
  <scope>system</scope>
  <systemPath>${project.basedir}/lib/xxx.jar</systemPath>
</dependency>

 (2)在<build>的spring-boot-maven-plugin中设置将本地jar包导出到项目最终的依赖库中:

<plugin>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-maven-plugin</artifactId>
  <configuration>
    <includeSystemScope>true</includeSystemScope>
  </configuration>
</plugin>

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注