nexus3批量上传jar包
将以下两个脚本放在待上传的仓库根目录下 ,删除所有lastUpdated文件和_remote.repositories文件后执行
sh upload.sh
即可将upload.sh同级目录及子目录下所有文件上传至 upload.sh内指定的远程仓库
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 './upload.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}/{} ;
upload.sh
## -u nexus用户名 -p nexus密码 -r 远程仓库地址
sh mavenimport.sh -u admin -p admin123 -r http://127.9.9.1:8081/repository/bemp-snapshots/