手動mvn命令上傳單個Jar linux
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倉庫全部jar包 bash
1.先將本地maven/repository倉庫打一個完整的zip壓縮包oracle
2.上傳到linux目錄,如:/optcurl
3.解壓repository.zipmaven
4.進入repository目錄this
5.建立touch mavenimport.sh腳本,寫入如下內容;url
#!/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進行可執行受權spa
7.執行導入命令 code
./mavenimport.sh -u admin -p admin123 -r http://ip:8081/repository/maven-releases/
8.等待所有導入完畢後,在Nexus上刷新便可看到已導入的jarxml
Nexus3界面上傳jar包