1.创建一个私有仓库
2.复制仓库地址
3.上传本地仓库到私有仓库
#在本地仓库目录下写个shell脚本,内容如下 #!/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}/{} ;
执行脚本到私有仓库,注意用户名密码及仓库地址
#给脚本执行权限 chmod +x mavenimport.sh #执行命令即可 ./mavenimport.sh -u admin -p password -r http://192.168.1.5:8081/repository/maven-test/