当前位置:   article > 正文

本地jar包批量上传Nexus私服_copy and run this script to the root of the reposi

copy and run this script to the root of the repository directory containing

背景:本地跑了个java微服务,需要把服务依赖的jar包上传到私服,批量传哦。服务器无法连接外网只能本地传。如果是一个很确认的jar直接在私服界面传即可。
1、把本地依赖的服务打成压缩包传到服务器上解压

手动传的zip压缩包
  • 1

2、生成脚本,脚本名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}/{} ;

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

3、执行脚本即可传到私服中

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

举例

chmod +x mavenimport.sh
./mavenimport.sh -u root -p 123456 -r http://192.168.34.2:1000/repository/ylsh_maven/
  • 1
  • 2
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/48381
推荐阅读
相关标签
  

闽ICP备14008679号