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>
相关推荐
CHICX12295 小时前
【Hadoop】改一下core-site.xml和hdfs-site.xml配置就可以访问Web UI
xml·大数据·hadoop
CS_GaoMing14 小时前
Centos7 JDK 多版本管理与 Maven 构建问题和注意!
java·开发语言·maven·centos7·java多版本
Java探秘者15 小时前
Maven下载、安装与环境配置详解:从零开始搭建高效Java开发环境
java·开发语言·数据库·spring boot·spring cloud·maven·idea
hhzz16 小时前
Linux Shell编程快速入门以及案例(Linux一键批量启动、停止、重启Jar包Shell脚本)
android·linux·jar
胡耀超19 小时前
知识图谱入门——8: KG开发常见数据格式:OWL、RDF、XML、GraphML、JSON、CSV。
xml·json·知识图谱·csv·owl·graphml·gml
晚睡早起₍˄·͈༝·͈˄*₎◞ ̑̑21 小时前
JavaWeb(二)
java·数据仓库·hive·hadoop·maven
编程、小哥哥1 天前
手写mybatis之Mapper XML的解析和注册使用
xml·java·mybatis
忙里偷闲的sin1 天前
整理Maven坐标,Spring Boot集成工具依赖版本差异问题
java·spring boot·maven
芝法酱1 天前
芝法酱学习笔记(0.6)——nexus与maven私库
java·maven·nexus
Muroidea1 天前
spring boot jar 分离自动部署脚本
spring boot·后端·jar