我的project.clj文件看起来像 -
(defproject somename "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.9.0"]
[org.apache.kafka/kafka-clients "0.11.0.2"]]
:main somename.core
:target-path "target/%s"
:profiles {:dev {:dependencies [[lein-light-nrepl "0.3.3"]
[enlive "1.1.6"]
[cheshire "5.8.0"]
[criterium "0.4.4"]]}}
:repl-options {:nrepl-middleware [lighttable.nrepl.handler/lighttable-ops]})
lein repl
在项目目录之外工作正常。
$ lein repl
nREPL server started on port 34420 on host 127.0.0.1 -
nrepl://127.0.0.1:34420
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_161-b12
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
user=>
但是,对于这个项目,当我在做lein deps
时,它无法拉动依赖项。
我收到的错误如 -
Could not transfer artifact org.apache.kafka:kafka-
clients:pom:0.11.0.2 from/to central (https://repo1.maven.org/maven2/): Connect to [localhost/127.0.0.1] failed: Connection refused (Connection refused)
This could be due to a typo in :dependencies or network issues.
If you are behind a proxy, try setting the 'http_proxy' environment variable.
Lein和java版本如下 -
$ lein version
Leiningen 2.7.1 on Java 1.8.0_161 Java HotSpot(TM) 64-Bit Server VM
$ java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
请帮助我。
答案 0 :(得分:1)
之前我遇到过完全相同的问题。我认为这是因为一些被编码的repo urls使用HTTP方案而不是HTTPS。 把它放在你的project.clj中应该有所帮助:
:repositories [["jitpack" "https://jitpack.io"]
["central" "https://repo1.maven.org/maven2"]
["clojure" "https://build.clojure.org/releases"]
["clojars" "https://clojars.org/repo"]
["java.net" "https://download.java.net/maven/2"]
["jboss.release" "https://repository.jboss.org/nexus/content/groups/public"]
["terracotta-releases" "https://www.terracotta.org/download/reflector/releases"]
["terracotta-snapshots" "https://www.terracotta.org/download/reflector/snapshots"]
["apache.snapshots" "https://repository.apache.org/snapshots"]]