使用NEXUS3私服上传三方jar包

本文详细介绍如何通过Maven命令行及Shell脚本自动化部署jar包到私有仓库,包括配置Maven setting文件、使用mvn命令进行部署,以及通过自定义sh脚本批量上传项目依赖。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、通过mvn 命令行

1.1、配置maven的setting文件

   </servers>
     <server>
        <id>3rd_part</id>
        <username>admin</username>
        <password>admin123</password>
     </server>
  </servers>

1.2 使用maven命令

mvn deploy:deploy-file -DgroupId=cpcn.dsp -DartifactId=Base-ProjectParent -Dversion=1.0 -Dpackaging=jar -Dfile=D:\lib\cpcn-dsp-api-1.0.0.36.jar -Durl=http://168.16.0.4:8088/repository/3rd_part/ -DrepositoryId=3rd_part

2、使用sh 脚本

1.1 脚本内容 mavenimport.sh

#!/bin/bash
# copy and run this script to the root of the repository directory containing files
# this script attempts to exclude uploading itself explicitly so the script name is important
# Get command line params
while getopts ":r:u:p:" opt; do
    case $opt in
        r) REPO_URL="$OPTARG"
        ;;
        u) USERNAME="$OPTARG"
        ;;
        p) PASSWORD="$OPTARG"
        ;;
    esac
done
 
find . -type f -not -path './mavenimport\.sh*' -not -path '*/\.*' -not -path '*/\^archetype\-catalog\.xml*' -not -path '*/\^maven\-metadata\-local*\.xml' -not -path '*/\^maven\-metadata\-deployment*\.xml' | sed "s|^\./||" | xargs -I '{}' curl -u "$USERNAME:$PASSWORD" -X PUT -v -T {} ${REPO_URL}/{} ;
 

1.2 执行脚本

./mavenimport.sh -u admin -p password -r http://172.1.6.16:8080/repository/maven-third/

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值