Nexus 作為 Sonatype 開發的 Maven 倉庫管理器,憑藉直觀 UI、強大索引、靈活代理策略,已成為 Maven 私服首選。本文記錄從下載安裝、核心配置、Maven 整合、Eclipse 索引使用、藍件上傳到新增代理倉庫的完整遷移過程。
nexus-webapp-1.0.0.zip (~16MB) 解壓。bin/jsw/windows-x86-32/ 目錄:
InstallNexus.bat / UninstallNexus.bat:安裝/卸載 Windows 服務Nexus.bat:前台控制台運行https://localhost:8081/nexus/,默認賬號 admin/admin123。索引功能極大提升依賴搜索體驗,默認關閉需手動開啟:
true<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus</id>
<url>https://localhost:8081/nexus/content/groups/public</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<repository>
<id>nexus-snapshots</id>
<url>https://localhost:8081/nexus/content/groups/public-snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories> ... 同理配置 public / public-snapshots ... </pluginRepositories>
</profile>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
<localRepository>G:/soft/maven/localRepository</localRepository>
如 Sun 專有包無法從中央倉庫獲取:
https://localhost:8081/nexus/content/groups/publicnexushttps://repository.jboss.com/maven2/https://download.java.net/maven/2/https://developer.k-int.com/maven2/ (含 Sun JMX 藍件)| 維度 | Nexus | Artifactory |
|---|---|---|
| 界面易用性 | ⭐⭐⭐⭐⭐ 現代、直觀 | ⭐⭐⭐ 功能性為主 |
| 遠程索引支持 | ⭐⭐⭐⭐⭐ 一鍵開啟、自動更新 | ⭐⭐ 配置複雜、文檔少 |
| Eclipse 整合 | ⭐⭐⭐⭐⭐ 索引搜索極速體驗 | ⭐⭐ 僅本地索引 |
| 群組/代理管理 | ⭐⭐⭐⭐ 視覺化拖拽排序 | ⭐⭐⭐ 配置文件編輯 |
| 社區活躍度 | ⭐⭐⭐⭐⭐ Sonatype 官方維護 | ⭐⭐⭐ JFrog 維護 |
綜合體驗,Nexus 全方位優於 Artifactory,強烈推薦作為 Maven 私服標準選擇。