gpt4 book ai didi

java - 无法从central/clojars中提取依赖项

转载 作者:行者123 更新时间:2023-12-02 11:37:58 24 4
gpt4 key购买 nike

我的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)

请帮我解决这个问题。

最佳答案

我之前也遇到过同样的问题。我认为发生这种情况是因为一些编码存储库 URL 使用 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"]]

关于java - 无法从central/clojars中提取依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48786098/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com