如何配置Leiningen以使用公司存储库



我们正在托管一个公司存储库,它作为知名存储库(例如Maven Central和Clojars)的代理。我希望莱宁根一开始就袭击公司仓库。只有当公司存储库无法交付工件时,Leiningen才应该询问标准存储库。这应该是我所有项目的默认行为。我需要做什么配置?

我已经在~/.lein/profiles.clj:

中添加了公司存储库作为镜像。
{:user {:mirrors {"our-repo" {:name "our-repo"
                              :url "http://our-repo/all/"}}}}

遗憾的是,此设置没有影响。Leiningen从Maven Central下载构件:

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

xsc建议用指向公司存储库的镜像定义覆盖Maven Central存储库。它的工作原理。现在,Leiningen不再使用外部Maven存储库,而是从公司存储库中检索构件。

S/He还建议指定一个额外的存储库定义来安装一个回退机制。不幸的是,这并不能很好地工作,因为Leiningen抱怨这个设置:

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

这个警告很烦人。出于这个原因,我将放弃这种设置。有没有其他方法来安装后备机制?

我是这么做的:

{: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向它发布工件。

我得到恼人的"可重复性"警告,但我正在努力摆脱它。

就我所能看到的Leiningen的示例项目而言。您必须使用要镜像的存储库的名称作为:mirrors映射中的键。那么,试试这个:

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

这很可能会完全替换存储库,所以您可能需要重新添加原始存储库:

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

相关内容

最新更新