使用Nexus搭建Maven私服(二)-更新私有倉庫索引

使用Nexus搭建Maven私服(二)-更新私有倉庫索引

    上一節內容已經介紹如何安裝安裝Nexus搭建Maven私服,本章具體介紹更新私有倉庫索引的方式

更新私有倉庫索引的方式

    (1)設置Central Repository --》 Download Remote Indexes:True 打開自動更新倉庫索引

             該種方式通過遠程下載更新私有倉庫,由於文件過大,且訪問一些國外下載地址,更新較慢,基本上很難進行完成更新,推薦使用手動更新

    (2)手動更新倉庫索引

自動方式更新私有倉庫索引

--》訪問搭建的Nexus服務,http://ip:port/nexus

--》使用默認用戶名/密碼:admin/admin123,進行登錄

--》設置Central Repository --》 Download Remote Indexes:True 打開自動更新倉庫索引

--》查詢下載任務(一般情況下全部下載速度時非常慢的這裏我們取消採用手動更新)

--》取消下載任務

--》完成

手動方式更新私有倉庫索引

    下載索引文件

         (1)indexer-cli-5.1.0.jar

                  下載地址:http://maven.outofmemory.cn/org.apache.maven.indexer/indexer-cli/5.1.0/

         (2)nexus-maven-repository-index.gz

                  下載地址:https://repo.maven.apache.org/maven2/.index/

         (3)nexus-maven-repository-index.properties

                  下載地址:https://repo.maven.apache.org/maven2/.index/

    手動更新步驟

--》進入Nexus安裝目錄,創建index目錄上傳下載文件

--》進入index目錄

cd /usr/local/nexus2.14/index

--》執行命令,解壓nexus-maven-repository-index.gz包需要耗費一段時間,需耐心等待解壓完成

java -jar indexer-cli-5.1.0.jar -u nexus-maven-repository-index.gz -d indexer

--》停止nexus服務

cd /usr/local/nexus2.14/nexus-2.14.13-01/bin
./nexus stop

--》刪除原有的索引文件(這裏需注意一定檢查一下是否是central-ctx目錄,不要錯誤其他目錄將所有文件刪除了,特別是跟目錄)

cd /usr/local/nexus2.14/sonatype-work/nexus/indexer/central-ctx
ls
rm -rf *

--》將解壓的所有索引文件拷貝到central-ctx目錄

cd /usr/local/nexus2.14/index/indexer
ls
cp -r * /usr/local/nexus2.14/sonatype-work/nexus/indexer/central-ctx

--》啓動nexus

cd /usr/local/nexus2.14/nexus-2.14.13-01/bin
./nexus start

--》訪問nexus的web服務,登錄查看索引是否更新完成

--》完成

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章