我是 Clojure 和 Leiningen 的新手,我确定我想要使用的一些内容位于 clojure.contrib.generic.math-functions 中。我在 http://richhickey.github.com/clojure-contrib/branch-1.1.x/math-api.html 找到了相关的 API 信息,但我找不到任何可以帮助我弄清楚应该在我的 project.clj 文件中放入该依赖项的内容。
我已经尝试过[clojure.contrib.generic.math-functions“1.1”]
,[clojure.contrib.generic.math-functions“1.1.x”]
,和[clojure.contrib.generic.math-functions“1.1.0”]
。对于每一个,我都会得到类似的东西......
...
Caused by: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException: Missing:
----------
1) clojure.contrib.generic.math-functions:clojure.contrib.generic.math-functions:jar:1.1
最佳答案
所有 clojure-contrib 命名空间都包含在单个 jar 文件中,必须列出依赖项,如下所示:
[org.clojure/clojure-contrib "1.2.0"]
请注意,该工件有不同的版本。 1.2.0 是当前的稳定版本。
为了在 clojure 代码中使用来自 math-functions 命名空间的函数,您需要 require
或use
这样的命名空间,通常在源文件开头的 ns
形式中完成:
(ns my.namespace
(:use [clojure.contrib.generic.math-functions]))
看看here查看 use
和 require
之间的差异。
关于clojure - 在莱宁根哪里可以找到依赖项的有效版本号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5917348/