需求
迁移Nexus新建一个空的Nexus服务,Nexus 自带的Upload功能一个一个上传jar 太痛苦
创建一个新仓库
- 创建Blob Stores
- 创建Nexus 代理仓库
该仓库作用就是当本地仓库不存在某个jar 的时候去远程仓库去拿,也可以不创建该仓库那代码加了新依赖就自己从本地手动上传吧
- 创建发行版仓库
- 创建快照版仓库
- 创建组将所有仓库整合
编辑脚本 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
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}/{} ;
将脚本放入本地仓库目录
使用GitBash执行脚本
这里只需要上传发行版和快照版 就可以了
./mavenimport.sh -u 账号 -p 密码 -r http://Nexus ip:Nexus端口/repository/仓库的名称
评论区