当前位置:网站首页>Shell常用脚本:Nexus批量上传本地仓库脚本
Shell常用脚本:Nexus批量上传本地仓库脚本
2022-07-31 22:31:00 【嗯嗯**】
文章参考: https://blog.csdn.net/qq_35237533/article/details/125159799
本人有对此脚本有做进一步增强,推荐使用我新写的增强脚本,如使用请到这个链接进行查看【20220727】 https://blog.csdn.net/weixin_39651356/article/details/126007459
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
# 步骤1:优化原作者有些无啥必要的筛选,因为写的必不起作用,特别注意 -path并不是正则,很像mysql的like模糊查询,大量使用到的转义字符压根没啥软用,而且就算是正则语法他写的也是错的
#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:当前目录下找出所有是文件非目录类型的文件 - 且排除掉mavenimport.sh文件
# 步骤2:将当前筛选出的文件绝对路径== 前面的 ./ 字符替换成空字符
# 如 ./cn/hutool/hutool-all/5.8.4/hutool-all-5.8.4.jar ==> cn/hutool/hutool-all/5.8.4/hutool-all-5.8.4.jar
# 如 ./cn/hutool/hutool-all/5.8.4/hutool-all-5.8.4.pom ==> cn/hutool/hutool-all/5.8.4/hutool-all-5.8.4.pom
# 步骤3:开始一个一个的上传文件(筛选出有多少行文件绝对路径,则curl则执行多少遍)
# curl -u "$USERNAME:$PASSWORD" -X PUT -v -T cn/hutool/hutool-all/5.8.4/hutool-all-5.8.4.jar ${REPO_URL}/cn/hutool/hutool-all/5.8.4/hutool-all-5.8.4.jar
# curl -u "$USERNAME:$PASSWORD" -X PUT -v -T cn/hutool/hutool-all/5.8.4/hutool-all-5.8.4.pom ${REPO_URL}/cn/hutool/hutool-all/5.8.4/hutool-all-5.8.4.pom
find . -type f -not -path '*mavenimport.sh*' | sed "s|^\./||" | xargs -I '{}' curl -u "$USERNAME:$PASSWORD" -X PUT -v -T {
} ${REPO_URL}/{
} ;
脚本使用
sh mavenimport.sh -u admin -p admin123 -r http://192.168.19.107:8082/repository/lrc/
上传成功
边栏推荐
- Go1.18 upgrade function - Fuzz test from scratch in Go language
- What is Thymeleaf?How to use.
- Golang - from entry to abandonment
- Basic Grammar Introduction of Carbon Tutorial (Tutorial)
- 二叉树非递归遍历
- focus on!Haitai Fangyuan joins the "Personal Information Protection Self-discipline Convention"
- Realize serial port receiving data based on STM32 ring queue
- @JsonFormat(pattern=“yyyy-MM-dd“)时间差问题
- Qualcomm cDSP simple programming example (to query Qualcomm cDSP usage, signature), RK3588 npu usage query
- useragent online lookup
猜你喜欢
Efficient Concurrency: A Detailed Explanation of Synchornized's Lock Optimization
Student management system on the first day: complete login PyQt5 + MySQL5.8 exit the operation logic
In Golang go-redis cluster mode, new connections are constantly created, and the problem of decreased efficiency is solved
Unity-LineRenderer显示一条线
二叉树非递归遍历
Realize serial port receiving data based on STM32 ring queue
嵌入式开发没有激情了,正常吗?
Redis Overview: Talk to the interviewer all night long about Redis caching, persistence, elimination mechanism, sentinel, and the underlying principles of clusters!...
Financial profitability and solvency indicators
[Intensive reading of the paper] iNeRF
随机推荐
iNeuOS industrial Internet operating system, equipment operation and maintenance business and "low-code" form development tools
Pytest初体验
嵌入式开发没有激情了,正常吗?
@JsonFormat(pattern="yyyy-MM-dd") time difference problem
【Yugong Series】July 2022 Go Teaching Course 025-Recursive Function
【公开课预告】:超分辨率技术在视频画质增强领域的研究与应用
Golang must know the Go Mod command
利用反射实现一个管理对象信息的简单框架
Istio introduction
UVM RAL model and built-in seq
什么是客户画像管理?
如何减少软件设计和实现之间鸿沟
cas and spin locks (is lightweight locks spin locks)
Judging decimal points and rounding of decimal operations in Golang
Unity - by casting and cloning method dynamic control under various UGUI create and display
BM3 将链表中的节点每k个一组翻转
Unity-通过预制件和克隆方法动态实现各个UGUI下控件的创建和显示
[Code Hoof Set Novice Village 600 Questions] Leading to the combination of formulas and programs
uniapp小程序检查、提示更新
Audio alignment using cross-correlation