当前位置:   article > 正文

本地maven批量导入nexus maven仓库中_如何把常用的 maven 库放到 nexus

如何把常用的 maven 库放到 nexus

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中下载

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/48678
推荐阅读
相关标签
  

闽ICP备14008679号