当前位置:网站首页>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/


上传成功
边栏推荐
- TestCafeSummary
- iNeuOS industrial Internet operating system, equipment operation and maintenance business and "low-code" form development tools
- Several methods for deleting specified elements in Golang slices
- A high-quality WordPress download site template theme developed abroad
- GateWay implements load balancing
- 10大主流3D建模技术
- Qualcomm cDSP simple programming example (to query Qualcomm cDSP usage, signature), RK3588 npu usage query
- How to debug TestCafe
- "SDOI2016" Journey Problem Solution
- Linux environment redis cluster to build "recommended collection"
猜你喜欢

MATLAB program design and application 2.4 Common internal functions of MATLAB

Bionic caterpillar robot source code

Implementation of a sequence table

Quick Start Tutorial for flyway
![[NLP] What is the memory of the model!](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[NLP] What is the memory of the model!

基于simulink的Active anti-islanding-AFD主动反孤岛模型仿真

新产品如何进行网络推广?
![[Code Hoof Set Novice Village 600 Questions] Leading to the combination of formulas and programs](/img/91/63d4f7869e0a55d19701c5ca5c9ed8.png)
[Code Hoof Set Novice Village 600 Questions] Leading to the combination of formulas and programs

Flex layout in detail

VOT2021比赛简介
随机推荐
基于simulink的Passive anti-islanding-UVP/OVP and UFP/OFP被动反孤岛模型仿真
UserAgent resolution
如何导入 Golang 外部包并使用它?
[QNX Hypervisor 2.2用户手册]9.16 system
Flink_CDC construction and simple use
[QNX Hypervisor 2.2 User Manual]9.14 set
Daily--Kali opens SSH (detailed tutorial)
信息学奥赛一本通 1941:【07NOIP普及组】Hanoi双塔问题 | 洛谷 P1096 [NOIP2007 普及组] Hanoi 双塔问题
Bionic caterpillar robot source code
JS basic exercises
ThreadLocal
Pytorch lstm time series prediction problem stepping on the pit "recommended collection"
ICML2022 | 深入研究置换敏感的图神经网络
useragent online lookup
SQL注入 Less46(order by后的注入+rand()布尔盲注)
Linux environment redis cluster to build "recommended collection"
Program processes and threads (concurrency and parallelism of threads) and basic creation and use of threads
linux view redis version command (linux view mysql version number)
基于单片机GSM的防火防盗系统的设计
不知道该怎么办的同步问题