Maven 私服搭建
由于公司研發環境物理隔絕,所以自己搭建了一個 maven 私服,以下是自己搭建私服過程中的一個記錄。
1.準備Maven私服相關文件
1.1 從 sonatype 官網?下載?nexus 安裝包
1.2 下載 maven 索引文件?http://repo1.maven.org/maven2/.index/
直接復制以下地址:
http://repo.maven.apache.org/maven2/.index/nexus-maven-repository-index.gz
http://repo.maven.apache.org/maven2/.index/nexus-maven-repository-index.properties
1.3 下載索引解壓文件?indexer-cli-5.1.1.jar
http://central.maven.org/maven2/org/apache/maven/indexer/indexer-cli/5.1.1/indexer-cli-5.1.1.jar
?
2. 安裝 nexus?
2.1 將步驟 1.1 下載的 nexus 文件拷貝到任意磁盤目錄,并解壓,如下圖:
2.2 根據操作系統版本打開 nexus 執行目錄,例如 windows7 x64,如下圖:
2.3 nexus 提供兩種方式,console-nexus.bat 通過命令行啟動,?install-nexus.bat 將 nexus 安裝為 windows系統服務,建議服務器采用windows服務的方式,安裝結果如下圖:
?
3. 更新索引
3.1 由于私服搭建到互聯網隔離環境,所以通過解壓索引的方式進行安裝,將下載好的文件放到同一個目錄
3.2 打開 windows 命令行,運行命令:?java -jar indexer-cli-5.1.1.jar -u nexus-maven-repository-index.gz -d indexer,運行結果如下圖:
3.3 打開 nexus 工作目錄, nexus\sonatype-work\nexus\indexer\central-ctx ,刪除目錄下已有的文件
3.4?將步驟 3.2 解壓后的索引文件拷貝到nexus工作目錄
3.5 啟動 nexus 服務,打開瀏覽器輸入地址:?http://localhost:8081/nexus/ ,點擊右上角 Log In ,輸入用戶名:admin ,密碼: admin123, 點擊左側?Repositories?
4. 修改 Maven 鏡像配置
4.1 Maven 安裝配置請移步?https://www.cnblogs.com/guoxulong/articles/9537212.html
?
4.2 打開maven目錄,在 conf 文件夾下找到?settings.xml, 右鍵編輯,查找?mirrors 節點,添加如下內容
<mirror><id>nexus-aliyun</id><name>Nexus aliyun</name><url>http://localhost:8081/nexus/content/groups/public/</url><mirrorOf>central</mirrorOf></mirror>?
5. 私服搭建完成,有問題歡迎大家指正,謝謝。
?
轉載于:https://www.cnblogs.com/guoxulong/p/9613961.html
總結
以上是生活随笔為你收集整理的Maven 私服搭建的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 记2018年9月PAT甲级考试(北京工业
- 下一篇: NOIP知识点