批量上传nexus-maven依赖

#!/bin/bash
# 批量上传nexus-maven依赖
# 使用方法:将本脚本文件放于本地maven仓库根目录,然后使用git-bash执行命令:
# sh mvnimport.sh -u 私服账号 -p 私服密码 -r 私服仓库地址

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}/{} ;

 

posted @ 2025-06-25 09:50  KeepSmiling_me  阅读(61)  评论(0)    收藏  举报