Nexus Repository Manager OSS 2 配置阿里雲私服做代理的坑


安裝

搭建 Nexus 私服很簡單,官網下載,解壓:

使用管理員權限打開cmd:

> cd nexus-2.14.14-01-bundle\nexus-2.14.14-01\bin
> nexus.bat install # 安裝nexus服務,然后在任務管理器啟動nexus服務即可

 

為什么使用nexus 2 而不是nexus 3?

1. nexus 3的UI沒有nexus 2緊湊好用

2. nexus 3 改用bytes存儲下載的jar包,不直觀。nexus 2 的 sonatype-work\nexus\storage\ 目錄下是能直接找到下載的jar包的。

3. 既有遺留系統使用的是nexus 2。這是主要原因。

PS:

如果使用nexus 3, 則不會遇到這個問題,直接按照常規套路配置阿里雲的proxy就能使用。

 

配置阿里雲代理

本來是很簡單的事情(常規做法:https://www.cnblogs.com/godwithus/p/8955824.html),但是有個隱藏的坑。

(1)在nexus manager中添加Proxy Repository:

 

填寫configuration:ID、Name這些都簡單,關鍵在這:

 

 兩個False。默認是True。地址用 https://maven.aliyun.com/repository/public 也行。

然后保存。

(2)刷新一下

 

 

 注意看上圖,Ali Repo(按上述設為兩個False)的狀態是In Service。aliyun repo1(默認True) 的 狀態是Remote Automatically Blocked and Unavailable

(3)將Ali Repo添加到public repo中,放在central的前面。OK。

(4)另一個bug。

雖然現在能正常使用了,但是在Browse Remote菜單下,還是無法查看遠程阿里雲repo的文件目錄的。這里aliyun repo的限制。不影響IDEA構建使用。

 

 

(5)最后檢查一下maven的settings.xml文件,在mirrors中添加:

<mirror>
    <!--This sends everything else to /public -->
    <id>nexus</id>
    <mirrorOf>central</mirrorOf>
    <name>my nexus</name
    <url>http://127.0.0.1:8081/nexus/content/groups/public/</url>
</mirror>

然后IDEA中使用OK。


免責聲明!

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



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