这是本地的maven库jar包
现在通过shell脚本批量上传nexus的maven-releases库中
Shell脚本
#!/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}/{} ;
保存此脚本文件比如touchmavenimport.sh,然后放到本地maven库最外层
批量上传
在脚本文件所在目录打开git命令窗口,因为windows是不能执行shell脚本的
然后执行下面命令
sh touchmavenimport.sh -u admin -p qq245700 -r http://127.0.0.1:8081/repository/maven-releases
可以看到在疯狂上传中
附
Maven安装私有jar到本地仓库
mvn install:install-file -Dfile=jta-1_0_1B.jar -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar
Maven上传单个jar到Nexus
mvn deploy:deploy-file -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar -Dfile=jta-1_0_1B.jar -Durl=http://192.168.0.112:8081/repository/maven-releases/ -DrepositoryId=maven-releases
评论区