有时我们要用的 maven 依赖项在官方repo库中找不到,然而我们从其他渠道获得了依赖项中的所有jar文件,本文记录了如何向本地库添加jar文件。 从复杂到简单,有三种方法: 使用 maven 的仓库管理器(例如Nexus)来架设一个本地仓库服务器 使用指令 mvn inst ...
有时我们要用的 maven 依赖项在官方repo库中找不到,然而我们从其他渠道获得了依赖项中的所有jar文件,本文记录了如何向本地库添加jar文件。
从复杂到简单,有三种方法:
- 使用 maven 的仓库管理器(例如Nexus)来架设一个本地仓库服务器
- 使用指令 mvn install:install-file 将jar文件安装到本地仓库
- 通过项目pom配置文件引入
第一种方法有利于团队开发,内容多一点,我打算单独用一篇文章记录。这里介绍其他两种方法:
使用指令 mvn install:install-file 将jar文件安装到本地仓库
语法规范:
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging> -DgeneratePom=true Where: <path-to-file> the path to the file to load <group-id> the group that the file should be registered under <artifact-id> the artifact name for the file <version> the version of the file <packaging> the packaging of the file e.g. jar
原标题:向Maven的本地库中添加jar文件
关键词:maven
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。