批量将jar包上传到,maven Nexus私服

创建如下sh脚本,脚本名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}/{} ;

将sh文件移动到,jar包的根目录,执行如下命令,即可上传到指定仓库

chmod +x mavenimport.sh
./mavenimport.sh -u 仓库账号 -p 仓库密码 -r http://ip:port/repository/ylsh_maven/

你可能感兴趣的:(jar,maven,java)