文章目录
通过 Maven 命令将 jar 包推送到私服
1. 命令
mvn deploy:deploy-file -DgroupId=com.ele -DartifactId=ele-sdk-order-get -Dversion=20210618 -Dpackaging=jar -Dfile=/Users/chenergao/Downloads/SDK-me.ele.retail_order.get-3-java/ocean.client.java.biz-order-get.jar -Durl=https://repo.rdc.aliyun.com/repository/*****/ -DrepositoryId=rdc-snapshots
2. 命令选项说明
2.1. 选项:-DgroupId
- groupId 对应着 pom 的 groupId,对应的值可以自定义
2.2. 选项:-DartifactId
- artifactId 对应着 pom 的 artifactId,对应的值可以自定义
2.3. 选项:-Dversion
- version 对应 pom 的 version
2.4. 选项:-Dpackaging
- packaging 对应打包的类型
2.5. 选项:-Dfile
- file 表示包目前在本地的路径
2.6. 选项:-Durl
- url 是远程私服地址
2.7. 选项-DrepositoryId
- repositoryId 区分是 release 还是 snapshot 版本
3. 使用场景说明
该命令通常在使用第三方 SDK 而第三方 SDK 中包含的 jar 包又无法通过 Maven 中央仓库下载,此时我们可以通过下载第三方 SDK 的 jar 包,通过此命令推送到我们自己的私服,从而达到在项目中通过 Maven dependency 方式进行引入的目的。