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/


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM