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


上传成功
边栏推荐
- Write a database document management tool based on WPF repeating the wheel (1)
- NVIDIA has begun testing graphics products with AD106 and AD107 GPU cores
- grep command written test questions
- Chapter Six
- [Intensive reading of the paper] iNeRF
- 「APIO2010」巡逻 题解
- 【ACM】2022.7.31训练赛
- sqlite3 simple operation
- 基于RT1052 Aworks nanopb string 类型固定长度使用方式(二十七)
- -xms -xmx(information value)
猜你喜欢

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

登录业务实现(单点登录+微信扫码+短信服务)

【Acwing】第62场周赛 题解

Audio alignment using cross-correlation

Socket Review and I/0 Model
![[Intensive reading of the paper] iNeRF](/img/a7/910667911e1ce8996b9d22de63ea04.png)
[Intensive reading of the paper] iNeRF

VOT2021比赛简介

Collation of knowledge points in Ningbo University NBU IT project management final exam

21. Support Vector Machine - Introduction to Kernel Functions

The old music player WinAmp released version 5.9 RC1: migrated to VS 2019, completely rebuilt, compatible with Win11
随机推荐
嵌入式开发没有激情了,正常吗?
Document management and tools in the development process
Redis综述篇:与面试官彻夜长谈Redis缓存、持久化、淘汰机制、哨兵、集群底层原理!...
sqlite3简单操作
20. Support vector machine - knowledge of mathematical principles
Verilog implements a divide-by-9 with a duty cycle of 5/18
一款国外开发的高质量WordPress下载站模板主题
Memblaze released the first enterprise-grade SSD based on long-lasting particles. What is the new value behind it?
@JsonFormat(pattern=“yyyy-MM-dd“)时间差问题
One thing to say, is outsourcing company worth it?
老牌音乐播放器 WinAmp 发布 5.9 RC1 版:迁移到 VS 2019 完全重建,兼容 Win11
如何减少软件设计和实现之间鸿沟
【Acwing】第62场周赛 题解
linux view redis version command (linux view mysql version number)
The old music player WinAmp released version 5.9 RC1: migrated to VS 2019, completely rebuilt, compatible with Win11
server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none failed
Summary of the classic drawing method of histogram
The latest masterpiece!Alibaba just released the interview reference guide (Taishan version), I just brushed it for 29 days
spark reports an error OutOfMemory "recommended collection"
Unity - by casting and cloning method dynamic control under various UGUI create and display