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