如果需要, 配置好认证信息
- 在maven安装路径下的
$MAVEN_HOME/conf/settings.xml
文件中,<servers>
节点配置认证信息; 其中<id>
和-DrepositoryId
后面的值进行匹配
<servers>
...
<server>
<id>2rd_repo_id</id>
<username>user_name</username>
<password>pass_word</password>
</server>
...
<servers>
命令
mvn deploy:deploy-file -DgroupId=com.qww -DartifactId=second-part-jar -Dversion=1.0.0 -Dpackaging=jar -Dfile=second-part-jar-1.0.0.jar -Durl=http://xxx.xx.xx.xx:port/repository/2rdParty/ -DrepositoryId=2rd_repo_id
# ----参数说明 ---
# -Dfile:本地jar文件路径
# -Durl:远程仓库url
# -DrepositoryId:仓库id,对应<server>下<id>节点值
# (如果提示401,认证失败,则检查: user_name 是否有权限; repositoryId 与 <server>.<id> 是否对应)