Nexus 2.x安裝、使用說明、問題總結
一、下載最新的 Nexus 2.x
二、安裝、啟動服務
1. 解壓至 F:\nexus2 資料夾,得到 nexus-版本號 資料夾和 sonatype-work 資料夾,nexus-版本號資料夾放的是nexus伺服器相關的檔案,sonatype-work放的是nexus工作的資料檔案,上傳下載的jar包就在這個資料夾下面。
2.進入 F:\nexus2\nexus-2.14.8-01\bin\jsw 資料夾,選擇符合系統版本的資料夾,這裡我選 windows-x86-64 64位系統,可以看下如下檔案:
console-nexus.bat:啟動nexus並在cmd中展示啟動過程。 install-nexus.bat:將nexus設定成windows服務,開機自動啟動。 start-nexus.bat:啟動nexus。 stops-nexus.bat:停止nexus。 uninstall-nexus.bat:與install-nexus.bat相對應,解除安裝nexus服務。
2.1、 執行 install-nexus.bat 安裝服務,若提示 wrapper | OpenSCManager failed - 拒絕訪問。 (0x5) 右擊,以管理員身份執行。
2.2、執行 start-nexus.bat 啟動服務,若提示 wrapper | OpenSCManager failed - 拒絕訪問。 (0x5) 右擊,以管理員身份執行。
2.3、訪問 localhost:8081/nexus 驗證服務是否真的開啟,若訪問成功,則服務啟動成功,若訪問失敗,則服務失敗。
三、登陸服務,獲取更多功能
使用者:admin
密碼:admin123
四、建立一個可上傳包的宿主倉庫 iwork-release
五、上傳JAR
六、更新倉庫索引Index
點選左邊的 Administration 下的 Scheduled Tasks 可以檢視當前任務進度。如果狀態為 running 則標示任務已經開始執行。
如果想看進度可以開啟 ->logs->wapper.log 檢視日誌。
如日誌中出現
jvm 1 | 2018-06-17 02:17:33,292+0800 INFO [pxpool-1-thread-1] admin org.sonatype.nexus.index.NexusScanningListener - Scanning of repositoryID="central" started. jvm 1 | 2018-06-17 02:17:33,761+0800 INFO [pxpool-1-thread-1] admin org.sonatype.nexus.index.NexusScanningListener - Scanning of repositoryID="central" finished: scanned=0, added=0, updated=0, removed=0, scanningDuration=0:00:00.469
started: 表示修復開始了
finished:表示修復完成了
scanned:掃描的數量,added:新增的數量,updated:更新的數量, removed:移除的數量
sanned的數量為 0 那是因為我剛剛新建的nexus服務還未用到它。裡面的包數量本身就為 0
七:健康檢查
分析完後,被Check的倉庫的 Health Check一欄會出現圖示
八、新增代理
若公司上網需要設定代理,那麼nexus私服也要設定,否則無法下載依賴的包
九、修改埠
進入 /conf 資料夾,開啟 nexus.properties 檔案,修改 application-port 一項
Jetty section
application-port=8081
application-host=0.0.0.0
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus