Nexus3.x批量导入本地库(Windows版)

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

将脚本放到本地repository地址下
http://你的ip:你的端口/repository/my_repo/ 为你nexus中的hosted类型的maven2 地址

./mavenimport.sh -u admin -p admin123 -r http://你的ip:你的端口/repository/my_repo/

sh可以使用git窗口,如果密码有特殊字符可能执行报错

posted @ 2021-08-14 17:21  fly_bk  阅读(672)  评论(0编辑  收藏  举报