Skip to content

curl -v --user "admin:admin" --upload-file ./ http://192.168.1.5:8081/repository/local/

批量上传脚本jar包

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

批量上传rpm包

find . -type f -not -path './upload.sh' | sed "s@^./@@" | xargs -I '{}' curl -u "$USERNAME:$PASSWORD" -X PUT -v -T {} ${REPO_URL}/{} ;

运行脚本

./import.sh -u admin -p admin -r http://192.168.1.5:8081/repository/local/