当前位置:网站首页>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/
上传成功
边栏推荐
- @JsonFormat(pattern=“yyyy-MM-dd“)时间差问题
- SQL注入 Less46(order by后的注入+rand()布尔盲注)
- Program processes and threads (concurrency and parallelism of threads) and basic creation and use of threads
- 基于mysql的消息队列设计
- Shell常用脚本:Nexus批量上传本地仓库增强版脚本(强烈推荐)
- flowable workflow all business concepts
- Transfer Learning - Domain Adaptation
- Fixed-length usage of nanopb string type based on RT1052 Aworks (27)
- Daily practice——Randomly generate an integer between 1-100 and see how many times you can guess.Requirements: The number of guesses cannot exceed 7 times, and after each guess, it will prompt "bigger"
- Commonly used security penetration testing tools (penetration testing tools)
猜你喜欢
20. Support vector machine - knowledge of mathematical principles
Unity - LineRenderer show a line
ThreadLocal
Pytest初体验
The article you worked so hard to write may not be your original
Shell常用脚本:Nexus批量上传本地仓库增强版脚本(强烈推荐)
Handwritten a simple web server (B/S architecture)
Judging decimal points and rounding of decimal operations in Golang
Shell常用脚本:Nexus批量上传本地仓库脚本
ICML2022 | 深入研究置换敏感的图神经网络
随机推荐
日常--Kali开启SSH(详细教程)
ECCV 2022 Huake & ETH propose OSFormer, the first one-stage Transformer framework for camouflaging instance segmentation!The code is open source!...
面试突击69:TCP 可靠吗?为什么?
In Golang go-redis cluster mode, new connections are constantly created, and the problem of decreased efficiency is solved
Unity - by casting and cloning method dynamic control under various UGUI create and display
IJCAI2022 | 代数和逻辑约束的混合概率推理
一款国外开发的高质量WordPress下载站模板主题
AI automatic code writing plugin Copilot (co-pilot)
C程序设计-方法与实践(清华大学出版社)习题解析
如何减少软件设计和实现之间鸿沟
LevelSequence source code analysis
Summary of the classic drawing method of histogram
程序进程和线程(线程的并发与并行)以及线程的基本创建和使用
iNeuOS industrial Internet operating system, equipment operation and maintenance business and "low-code" form development tools
(26) About menu of the top menu of Blender source code analysis
linux view redis version command (linux view mysql version number)
TestCafeSummary
Document management and tools in the development process
[Code Hoof Set Novice Village 600 Questions] Merge two numbers without passing a character array
The article you worked so hard to write may not be your original