java 压缩jar 仓库,批量上传Maven仓库jar包到Nexus私服

批量上传Maven仓库jar包到Nexus私服

1.先将本地maven/localrepository仓库打一个完整的zip压缩包

2.上传到linux目录,如:/opt

3.解压localrepository.zip到/opt路径下

4.进入解压后的/opt/localrepository目录

5.1-4步,可以通过FTP/SFTP工具,直接将本地localrepository上传到/opt/localrepository

6.在/opt/localrepository目录下创建touch 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 optinr)REPOURL="opt in

r) REPO_URL="optinr)REPOU​RL="OPTARG"

;;

u) USERNAME=“OPTARG";;p)PASSWORD="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 “USERNAME:USERNAME:USERNAME:PASSWORD” -X PUT -v -T {} ${REPO_URL}/{} ;

7.输入chmod a+x mavenimport.sh进行可执行授权

8.执行导入命令 (注意:将地址换成自己的私服地址)

./mavenimport.sh -u admin -p admin123 -r http://ip:8081/repository/maven-releases/

9.等待全部导入完毕后,在Nexus上刷新即可看到已导入的jar

java 压缩jar 仓库,批量上传Maven仓库jar包到Nexus私服_第1张图片

本文地址:https://blog.csdn.net/txl12345678/article/details/107322896

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

你可能感兴趣的:(java,压缩jar,仓库)