nexus批量上传jar包
一、进入到linux的用户目录下:
cd /home/app/
二、创建上传脚本:
vi import.sh
内容如下:
#!/bin/bash
while getopts “:r:u:p:” opt; do
case
o
p
t
i
n
r
)
R
E
P
O
U
R
L
=
"
opt in r) REPO_URL="
optinr)REPOURL="OPTARG"
;;
u) USERNAME=“
O
P
T
A
R
G
"
;
;
p
)
P
A
S
S
W
O
R
D
=
"
OPTARG" ;; p) PASSWORD="
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 “
U
S
E
R
N
A
M
E
:
USERNAME:
USERNAME:PASSWORD” -X PUT -v -T {} ${REPO_URL}/{} ;
三、将所有包含jar包的文件夹放在本目录下
eg:com.apach.maven 只需将整个com包放在目录下即可
四、执行脚本
./mavenimport.sh -u xxx -p xxx -r http://192.0.0.1:8081/repository/my_repo/