maven -nexus 导入已有的maven仓

参考:https://www.jianshu.com/p/6971fca953fc 

## nexus新建本地仓my_repo

## 新建一个文件夹 myrepo,将本地仓库的包批量放入我们需要的本地库文件夹,注意必须将package层级都拷贝

## 在 myrepo文件夹下执行如下命令创建一个 shell 脚本:mavenimport.sh

chmod +x mavenimport.sh

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/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 admin -p 123 -r http://192.168.60.133:8081/repository/my_repo/

注意:1.导入到nexus 上要是空的仓库。

  2.导入后需要rebuild index 

 

posted @   higsan  阅读(35)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示