[Maven] Nexus3 uploads maven dependency jar

Backend dependencies

Last time we talked about the batch upload of tgz files on the front end to the private server. In fact, the server has a similar situation. We have a private server that also needs to be uploaded to the private server. Here is a record. Because I didn’t pay attention to a small detail last time and passed it on in vain, so I’ll re-record it here and summarize it.

# 查看一下结构
$ tree -L 2
.
|-- repository
|   |-- com
|   |-- aopalliance
|   |-- asm
|   |-- aspectj
|   |-- import_jar_pom.sh #jar包文件
|   |-- import_sha1.sh     #sha1文件

Insert image description here
create a new fileimport_jar_pom.sh

#!/bin/bash

#将此脚本复制并运行到包含文件的存储库目录的根目录
while getopts ":r:u:p:" opt; do
	case $opt in
		r) REPO_URL="https://url.localhost.com/artifactory/prj-release-maven-virtual"   #目标仓库地址
		;;
		u) USERNAME="username"   #具有读写仓库权限的账号
		;;
		p) PASSWORD="password"   #账号对应的制品库API-key
		;;
	esac
done
echo "curl -u "$USERNAME:$PASSWORD" -X PUT -v -T {} ${REPO_URL}/{} "

find . -type f  -name *.jar -o -name *.pom | sed "s|^\./||" | xargs -I '{}' curl -u "$USERNAME:$PASSWORD" -X PUT -v -T {
    
    } ${REPO_URL}/{
    
    };

# find . -type f  -name *.jar -o -name *.pom | sed "s|^\./||" | xargs -I '{}' curl -u "username:password" -X PUT -v -T {} https://url.localhost.com/artifactory/prj-release-maven-virtual/{} ;

Insert image description here

Newimport_sha1.sh

#!/bin/bash

OPTARG_R=https://url.localhost.com/artifactory/prj-release-maven-virtual
OPTARG_U=username
OPTARG_P=password

while getopts ":r:u:p:" opt; do
	case $opt in
		r) REPO_URL="$OPTARG_R"
		;;
		u) USERNAME="$OPTARG_U"
		;;
		p) ="$OPTARG_P"
		;;
	esac
done
find . -type f -name *.sha1  | sed "s|^\./||" | xargs -I '{}' curl -u "$USERNAME:$PASSWORD" -X PUT -v -T {
    
    } ${REPO_URL}/{
    
    } ;

Front-end dependencies

【npm】Nexus3 upload npm depends on tgz

Guess you like

Origin blog.csdn.net/u010638673/article/details/132049837