批量上传Maven仓库jar包到Nexus私服
批量上传Maven仓库jar包到Nexus私服
1.先将本地maven/localrepository仓库打一个完整的zip压缩包
2.上传到linux目录,如:/opt
3.解压localrepository.zip到/opt路径下
4.进入解压后的/opt/localrepository目录
5.1-4步,可以通过FTP/SFTP工具,直接将本地localrepository上传到/opt/localrepository
6.在/opt/localrepository目录下创建touch 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 OPTARG"
;;
u) USERNAME=“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 “PASSWORD” -X PUT -v -T {} ${REPO_URL}/{} ;
7.输入chmod a+x mavenimport.sh进行可执行授权
8.执行导入命令 (注意:将地址换成自己的私服地址)
./mavenimport.sh -u admin -p admin123 -r http://ip:8081/repository/maven-releases/
9.等待全部导入完毕后,在Nexus上刷新即可看到已导入的jar
本文地址:https://blog.csdn.net/txl12345678/article/details/107322896
上一篇: python函数高级用法教程
下一篇: Python基础整理操作积累