当前位置:网站首页>Batch uploading of local jar packages to nexus private server

Batch uploading of local jar packages to nexus private server

2022-06-25 18:17:00 RT_ 0114

background : I ran a local java Microservices , The service needs to be dependent on jar Upload the package to private server , Batch transfer . The server cannot connect to the Internet. It can only transmit data locally . If it is a very confirmed jar It can be transferred directly in the private server interface .
1、 Turn the locally dependent services into compressed packages and send them to the server for decompression

 Manual transmission zip Compressed package 

2、 Generation script , Script name 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}/{
    } ;

3、 Execute the script and transfer it to the private server

chmod +x mavenimport.sh
./mavenimport.sh -u  Warehouse account number  -p  Warehouse password  -r http://ip:port/repository/ylsh_maven/

give an example

chmod +x mavenimport.sh
./mavenimport.sh -u root -p 123456 -r http://192.168.34.2:1000/repository/ylsh_maven/
原网站

版权声明
本文为[RT_ 0114]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202190532130219.html