参考:https://www.jianshu.com/p/6971fca953fc
## nexus新建本地仓my_repo
## 新建一个文件夹 myrepo,将本地仓库的包批量放入我们需要的本地库文件夹,注意必须将package层级都拷贝
## 在 myrepo文件夹下执行如下命令创建一个 shell 脚本:mavenimport.sh
chmod +x 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}/{} ;
## 执行导入
./mavenimport.sh -u admin -p 123 -r http://192.168.60.133:8081/repository/my_repo/
注意:1.导入到nexus 上要是空的仓库。
2.导入后需要rebuild index
标签:mavenimport,nexus,sh,maven,##,导入,path From: https://www.cnblogs.com/heshana/p/17108704.html