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