当前位置:首页 > 编程笔记 > 正文
已解决

本地maven批量导入nexus maven仓库中

来自网友在路上 157857提问 提问时间:2023-10-30 20:51:25阅读次数: 57

最佳答案 问答题库578位专家为你答疑解惑

1、在本地的maven仓库中创建两个脚本

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}/{} ;

 startup.sh里边的内容是:

./mavenimport.sh  -u admin -p 123456 -r http://192.168.142.144:8081/repository/maven-releases/

 -u 后边是nexus的用户名

-p 后边是nexus用户名的密码

-r 后边是nexus中maven仓库的地址

2、在本地打开git bash,并且切换到本地maven仓库的路径下,执行startup.sh,下边的图片就是显示往nexus中下载

查看全文

99%的人还看了

猜你感兴趣

版权申明

本文"本地maven批量导入nexus maven仓库中":http://eshow365.cn/6-28039-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!