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


上传成功
边栏推荐
- A shortcut to search for specific character content in idea
- 高等代数_证明_任何矩阵都相似于一个上三角矩阵
- In Golang go-redis cluster mode, new connections are constantly created, and the problem of decreased efficiency is solved
- focus on!Haitai Fangyuan joins the "Personal Information Protection Self-discipline Convention"
- Several methods of mysql backup table
- ECCV 2022 Huake & ETH propose OSFormer, the first one-stage Transformer framework for camouflaging instance segmentation!The code is open source!...
- Linux environment redis cluster to build "recommended collection"
- 10大主流3D建模技术
- 【Acwing】第62场周赛 题解
- Chapter Six
猜你喜欢

ECCV 2022 Huake & ETH propose OSFormer, the first one-stage Transformer framework for camouflaging instance segmentation!The code is open source!...

Student management system on the first day: complete login PyQt5 + MySQL5.8 exit the operation logic

面试突击69:TCP 可靠吗?为什么?

Unity-通过预制件和克隆方法动态实现各个UGUI下控件的创建和显示

一款国外开发的高质量WordPress下载站模板主题

Daily--Kali opens SSH (detailed tutorial)

VOT2021比赛简介

数据分析(一)——matplotlib

网络安全--通过握手包破解WiFi(详细教程)

高等代数_证明_任何矩阵都相似于一个上三角矩阵
随机推荐
基于单片机GSM的防火防盗系统的设计
HTC使用官方固件作为底包制作rom卡刷包教程
-xms -xmx(information value)
Student management system on the first day: complete login PyQt5 + MySQL5.8 exit the operation logic
基于RT1052 Aworks nanopb string 类型固定长度使用方式(二十七)
"SDOI2016" Journey Problem Solution
LeetCode 第 304 场周赛
Efficient Concurrency: A Detailed Explanation of Synchornized's Lock Optimization
"APIO2010" Patrol Problem Solution
网易云信圈组上线实时互动频道,「破冰」弱关系社交
登录业务实现(单点登录+微信扫码+短信服务)
Niuke.com brush questions (1)
20. Support vector machine - knowledge of mathematical principles
What is customer profile management?
TestCafeSummary
AI automatic code writing plugin Copilot (co-pilot)
Golang must know the Go Mod command
server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none failed
面试突击69:TCP 可靠吗?为什么?
Bionic caterpillar robot source code