当前位置:网站首页>Shell common script: Nexus batch upload local warehouse script
Shell common script: Nexus batch upload local warehouse script
2022-07-31 22:51:00 【Uh-huh**】
文章参考: https://blog.csdn.net/qq_35237533/article/details/125159799
本人有对此脚本有做进一步增强,推荐使用我新写的增强脚本,如使用请到这个链接进行查看【20220727】 https://blog.csdn.net/weixin_39651356/article/details/126007459
mavenimport.sh == 必须!必须!必须!将此脚本放在待上传的本地仓库里面,Just put it on the son layer,Don't put it on the grandchild layer
#!/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/


上传成功
边栏推荐
- SQL注入 Less38(堆叠注入)
- 二叉树非递归遍历
- focus on!Haitai Fangyuan joins the "Personal Information Protection Self-discipline Convention"
- Commonly used security penetration testing tools (penetration testing tools)
- "SDOI2016" Journey Problem Solution
- linux view redis version command (linux view mysql version number)
- MySQL数据库‘反斜杠\’ ,‘单引号‘’,‘双引号“’,‘null’无法存储
- 什么是客户画像管理?
- Flex layout in detail
- Verilog implements a divide-by-9 with a duty cycle of 5/18
猜你喜欢

Qualcomm cDSP simple programming example (to query Qualcomm cDSP usage, signature), RK3588 npu usage query

C#中引用类型的变量做为参数在方法调用时加不加 ref 关键字的不同之处

Go1.18 upgrade function - Fuzz test from scratch in Go language

Implementing a Simple Framework for Managing Object Information Using Reflection

Flex layout in detail

基于单片机GSM的防火防盗系统的设计

Program processes and threads (concurrency and parallelism of threads) and basic creation and use of threads

20. Support vector machine - knowledge of mathematical principles

UOS统信系统 - WindTerm使用

MATLAB program design and application 2.4 Common internal functions of MATLAB
随机推荐
How to debug TestCafe
Network security - crack WiFi through handshake packets (detailed tutorial)
Go1.18 upgrade function - Fuzz test from scratch in Go language
How to get useragent
【Acwing】第62场周赛 题解
Components of TypeScript
[Intensive reading of the paper] iNeRF
"SDOI2016" Journey Problem Solution
20. Support vector machine - knowledge of mathematical principles
uniapp小程序检查、提示更新
Structure of the actual combat battalion module eight operations
cas and spin locks (is lightweight locks spin locks)
The article you worked so hard to write may not be your original
"SDOI2016" Journey Problem Solution
Commonly used security penetration testing tools (penetration testing tools)
iNeuOS industrial Internet operating system, equipment operation and maintenance business and "low-code" form development tools
IJCAI2022 | 代数和逻辑约束的混合概率推理
TestCafeSummary
C程序设计-方法与实践(清华大学出版社)习题解析
MATLAB program design and application 2.4 Common internal functions of MATLAB