利用 http 进行jar上传到nexus 批量批量~~~
某天领导发一个压缩包给你;你解压一下 几十个jar包;领导说这个封装好的sdk包请将他上传到nexus 上面供大家使用!
你看了看管理页面可以一个一个上传 你好像也开心不起来;所以加油~~~
保证对应group 一级进行命令执行
如:
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.8.1</version>
</dependency>
groupId 以com开头我们就需要将我们的命令文件放在和com同级;依旧层级进行jar包的放置;可参考本地 maven 仓库里面的内容
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
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}/{} ;
执行命令 :
./mavenimport.sh -u 账号 -p 密码 -r 请求地址/repository/仓库名称