给学Clojure的小伙伴:如何设置clojars国内源并防止TLS错误

这是我折腾几天搞得东西,这是我的project.clj:

(defproject db "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [korma "0.3.0-RC5"]
                 [org.clojure/java.jdbc "0.2.2"]
                 [mysql/mysql-connector-java "5.1.6"]
                 [org.clojure/clojure-contrib "1.2.0"]
                 [com.novemberain/monger "3.1.0"]
                 ]
  :repositories [["central" "http://maven.aliyun.com/nexus/content/groups/public"]
                 ["clojars" "https://mirrors.tuna.tsinghua.edu.cn/clojars/"]]
  :main db.core)

(require 'cemerick.pomegranate.aether)
(cemerick.pomegranate.aether/register-wagon-factory!
 "http" #(org.apache.maven.wagon.providers.http.HttpWagon.))

重点在:repositories和defproject外面那行代码,然后一个lein deps搞定依赖

另外如果有像我一样用linux的小伙伴,在用clojure调用jdbc的时候,记得sudo apt install libmysql-java

2 个赞

楼主这思路有些偏,还是尽量要用 https。我一直用的 huaweicloud ,速度还不错。可参考:

这shorthand是啥?全局alias?

嗯,类似全局 alias