Clojure项目里使用国内源

Clojars在国内的访问速度不尽人意,最近清华大学开源软件镜像站提供了Clojars的镜像。

project.clj里添加如下配置即可使用清华镜像:

:mirrors {#"clojars"
          {:name "Clojar Mirror"
           :url "https://mirrors.tuna.tsinghua.edu.cn/clojars"
           :repo-manager true}}

如果想要在所有的leinigen项目里使用上述镜像,只需把上面的配置添加到~/.lein/profiles.clj:user下面。

其它Maven源也可加进去,如使用阿里云的镜像:

:mirrors {#"clojars"
            {:name "Clojar Mirror"
             :url "https://mirrors.tuna.tsinghua.edu.cn/clojars"
             :repo-manager true}
            #"central"
            {:name "Maven aliyun"
             :url "https://maven.aliyun.com/repository/public"
             :repo-manager true}}

leiningen配置中的:mirrors:repositories类似。简单地说,两者都可以添加依赖包仓库,但mirrrors配置的仓库会自动替换同名的默认仓库。更多说明参考sample.project.clj

Comment