2014-03-28 35 views
10

我們正在託管一個企業存儲庫,作爲衆所周知的存儲庫(例如Maven Central和Clojars)的代理。我希望Leiningen首先打擊企業存儲庫。只有當企業存儲庫未能交付工件時,Leiningen纔會詢問標準存儲庫。這應該是我所有項目的默認行爲。我必須做什麼配置?如何將Leiningen配置爲使用公司存儲庫?

我加入公司資源庫在〜/ .lein/profiles.clj鏡子

{:user {:mirrors {"our-repo" {:name "our-repo" 
           :url "http://our-repo/all/"}}}} 

遺憾的是此設置沒有任何影響。 Leiningen下載從中央Maven的文物:

PS> lein repl 
Retrieving org/clojure/clojure/1.5.1/clojure-1.5.1.pom from central 
... 

更新

XSC表明覆蓋有指向公司資源庫的鏡子定義Maven的中央存儲庫。有用。現在,不要去外部Maven倉庫Leiningen從公司倉庫中檢索工件。

他還建議指定一個額外的存儲庫定義來安裝回退機制。 不幸的是,這並不工作這麼好,因爲Leiningen抱怨此設置:

:repositories detected in user-level profiles! [:user] 
See https://github.com/technomancy/leiningen/wiki/Repeatability 

這個警告是很煩人的。出於這個原因,我會放棄這種設置。是否有另一種方法來安裝回退機制?

回答

2

據我所見,在Leiningen's example project.clj你必須使用存儲庫的名稱鏡像:mirrors地圖中的關鍵。所以,試試這個:

{:mirrors {"central" { ... }}} 

這很可能會完全取代庫,所以你可能要重新添加原文:

{:mirrors  {"central" {:url "..." }} 
:repositories {"maven" {:url "http://repo1.maven.org/maven2/"}}} 
2

這裏對我來說是什麼在起作用:

{:user {:mirrors {#".+" {:url "http://nexus.example.com:8081/nexus/content/groups/public"}} 
     :repositories [["snapshots" {:id "NudaySnapshots" 
            :url "http://nexus.example.com:8081/nexus/content/repositories/snapshots"}] 
         ["releases" {:id "NudayReleases" 
            :url "http://nexus.example.com:8081/nexus/content/repositories/releases" 
            :sign-releases false}]]} 
:auth {:repository-auth {#"nexus.example.com" {:username "deployment" 
               :password "foo bar baz"}}}} 

這既可以通過我的Nexus鏡像解決依賴關係,也可以通過lein deploy發佈工件。

我得到惱人的「重複性」警告,但我正在努力擺脫這一點。

+0

糟糕,看起來像我需要的鏡子位。我在本地Maven倉庫中安裝了一個依賴項,它隱藏了一個問題。稍後將更新我的答案。 –

相關問題