mkdir /home/data/nexus-data
chmod 777 nexus-data
docker run --restart="always" -d -p 8899:8081 --name nexus -v /home/data/nexus-data:/nexus-data sonatype/nexus3
訪問:http://localhost:8899
登錄:用戶名:admin? 密碼:第一次密碼要用 /home/data/nexus-data/admin.password中的密碼,登錄之后系統(tǒng)會提示修改密碼
mkdir /home/repo2
chmod -R 777 /home/repo2
vi mavenimport2.sh
************** 內(nèi)容 start **************
#!/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}/{} ;
************** 內(nèi)容 end **************
cd /home/repo2
將本地的manven倉庫壓縮,如果本地壓縮文件大于4G建議采用7z進(jìn)行壓縮,然后傳到服務(wù)器到進(jìn)行解壓
7za a spring_cloud_resposiory.7z spring_cloud_resposiory/
7za x spring_cloud_resposiory.7z
mv mavenimport2.sh /home/repo2/spring_cloud_resposiory/
將mavenimport2.sh文件放入spring_cloud_resposiory文件中
./mavenimport2.sh? -u admin -p admin123 -r http://192.168.0.129:8899/repository/znyg/