搭建Nexus私服實現本地拉取依賴包


搭建Nexus私服實現本地拉取依賴包

轉載於https://dbawsp.com/1439.html

安裝JDK與Nexus環境:

修改主機名:

hostnamectl set-hostname nexus
bash
 

網站內搜索:

jdk-8u181-linux-x64.rpm
mkdir /home/tools && cd /home/tools
 

點擊下載JDK環境RPM包

rpm -ivh jdk-8u181-linux-x64.rpm
 

下載Nexus程序:

點擊下載Nexus程序包

部署並啟動Nexus程序:

tar xf nexus-3.13.0-01-unix.tar.gz mv nexus-3.13.0-01 /usr/local/nexus cd /usr/local/nexus/bin/ ./nexus start
 
  • Nexus會把所有磁盤當成存儲空間,硬盤越大,啟動越慢

查看Nexus端口:

netstat -tunpl|grep '8081'
 

界面操作Nexus:

用戶:admin
密碼:admin123
 

配置Maven全局配置:

cd /usr/local/maven/conf/ && vim settings.xml
 
  • 找到 標簽,添加 Nexus 默認認證信息:(132行下)
    <server> <id>my-nexus-releases</id> <username>admin</username> <password>admin123</password> </server> <server> <id>my-nexus-snapshot</id> <username>admin</username> <password>admin123</password> </server>
 
  • 找到 標簽,在修改server標簽后添加鏡像:(168行下)
    <mirror> <!--This sends everything else to /public --> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://10.0.0.80:8081/repository/maven-public/</url> </mirror>
 
  • 找到 標簽,在修改mirrir標簽后添加倉庫信息:(262行下)
<profile> <id>nexus</id> <!--Enable snapshots for the built in central repo to direct --> <!--all requests to nexus via the mirror --> <repositories> <repository> <id>central</id> <url>http://10.0.0.80:8081/repository/maven-public/</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <url>http://10.0.0.80:8081/repository/maven-public/</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </pluginRepository> </pluginRepositories> </profile>
 
  • 激活倉庫:(293行下)
<activeProfiles> <!--make the profile active all the time --> <activeProfile>nexus</activeProfile> </activeProfiles>
 

上傳並解壓jeesns源碼包:

cd /tmp/ && tar xf jeesns.tar.gz && cd jeesns/
 

編譯源碼包:

rm -rf /root/.m2/ mvn clean package
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM