溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

如何批量上傳Maven倉(cāng)庫(kù)jar包到Nexus3.x私服

發(fā)布時(shí)間:2021-10-21 16:47:39 來(lái)源:億速云 閱讀:1882 作者:柒染 欄目:大數(shù)據(jù)

這篇文章將為大家詳細(xì)講解有關(guān)如何批量上傳Maven倉(cāng)庫(kù)jar包到Nexus3.x私服,文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個(gè)參考,希望大家閱讀完這篇文章后對(duì)相關(guān)知識(shí)有一定的了解。

手動(dòng)mvn命令上傳單個(gè)Jar 

mvn deploy:deploy-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=10.2.0.1.0 -Dpackaging=jar -Dfile=D:\\ojdbc6.jar -Durl=http://ip:8081/repository/maven-releases/ -DrepositoryId=nexus

批量上傳maven倉(cāng)庫(kù)所有jar包

1.先將本地maven/repository倉(cāng)庫(kù)打一個(gè)完整的zip壓縮包

2.上傳到linux目錄,如:/opt

3.解壓repository.zip

4.進(jìn)入repository目錄

5.創(chuàng)建touch mavenimport.sh腳本,寫(xiě)入以下內(nèi)容;

#!/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}/{} ;

6.輸入chmod a+x mavenimport.sh進(jìn)行可執(zhí)行授權(quán)

7.執(zhí)行導(dǎo)入命令 

./mavenimport.sh -u admin -p admin123 -r http://ip:8081/repository/maven-releases/

8.等待全部導(dǎo)入完畢后,在Nexus上刷新即可看到已導(dǎo)入的jar

如何批量上傳Maven倉(cāng)庫(kù)jar包到Nexus3.x私服

Nexus3界面上傳jar包

如何批量上傳Maven倉(cāng)庫(kù)jar包到Nexus3.x私服

關(guān)于如何批量上傳Maven倉(cāng)庫(kù)jar包到Nexus3.x私服就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI