1、通过mvn 命令行
1.1、配置maven的setting文件
</servers>
<server>
<id>3rd_part</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
1.2 使用maven命令
mvn deploy:deploy-file -DgroupId=cpcn.dsp -DartifactId=Base-ProjectParent -Dversion=1.0 -Dpackaging=jar -Dfile=D:\lib\cpcn-dsp-api-1.0.0.36.jar -Durl=http://168.16.0.4:8088/repository/3rd_part/ -DrepositoryId=3rd_part
2、使用sh 脚本
1.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}/{} ;
1.2 执行脚本
./mavenimport.sh -u admin -p password -r http://172.1.6.16:8080/repository/maven-third/