1.腳本內容,將以下內容保存為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}/{} ;
2.git上執行./mavenimport.sh -u admin -p admin123 -r http://10.64.39.86:8081/nexus/content/repositories/scrk_public/
./mavenimport.sh -u admin -p admin123 -r http://10.64.39.86:8081/nexus/content/repositories/scrk_public/
注:admin/admin123為私服賬號密碼 http........為私服文件保存路徑
