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>
相关推荐
yuzhiboyouye12 小时前
my-batisPlus什么时候用xml什么时候用mapper自带的方法,这两种写法专业一点叫什么,什么场景分别使用
xml
howard200515 小时前
3.3 开发环境 - Maven
maven·安装·配置·阿里镜像源
xinjia_ctrl1 天前
暑假实习总结
git·后端·spring·maven·intellij-idea
网络豆1 天前
Apache Maven 鸿蒙 PC 适配全记录:把 JVM 构建工具交付到 HiShell
maven·apache·harmonyos
筝筝ba2 天前
如何跳过FFDC
xml·linux·运维·服务器·网络
yuzhiboyouye2 天前
那xml对应的sql语法,列举一下
xml·数据库·sql
sunshine22 girl3 天前
Java学习一 环境配置2 Idea的入门使用和maven配置,项目启动脚本配置
java·maven
sunshine22 girl4 天前
Java学习一 环境配置3 Idea中的maven仓库,pom.xml文件配置
学习·maven·intellij-idea
钱栈up5 天前
mvn compile卡住半小时:定位并修复隐藏的类型不匹配编译错误
java·后端·maven
Sayai5 天前
不重新打包,vim 直接改 jar 包内的前端文件:原理、步骤与避坑
前端·vim·jar