【发布时间】:2011-10-23 04:26:59
【问题描述】:
我正在尝试了解如何将 lein 与 clojure 一起使用,并让它在 Win7 x64 上下载正确的 .jar 文件。作为一个具体的例子,我正在尝试使用 JFreeChart 和 Dejcartes。
我的问题是通用的,并不特定于 JfreeChart。我基本上不明白如何缩小看到使用某些特定包的示例与通过 lein 为我提供该包之间的差距。希望有人能以同样适用于其他包的方式回答。
参考此链接:https://github.com/markmfredrickson/dejcartes/blob/master/Readme.txt 我的 project.clj 是这样的(注释掉这篇文章的最后两行)。
(defproject monty "1.0.0-SNAPSHOT"
:description "Monty Game Challenge"
:dependencies [[org.clojure/clojure "1.2.1"]
[org.clojure/clojure-contrib "1.2.0"]
;[org.jfree/chart "1.0.13"]])
[com.markmfredrickson/dejcartes "1.0.0"]])
-
我看到在 Dejcartes readme.txt 中使用了
(import '(org.jfree.chart chartframe)),所以我认为这意味着我需要 JFreeChart 的 .jar 文件,对吧?我将
[org.jfree/chart "1.0.13"]放在我的project.clj 中,但lein deps抱怨如下:C:\Users\me\code\Clojure\monty>lein deps Downloading: org/jfree/chart/1.0.13/chart-1.0.13.pom from central Downloading: org/jfree/chart/1.0.13/chart-1.0.13.pom from clojure Downloading: org/jfree/chart/1.0.13/chart-1.0.13.pom from clojars Downloading: org/jfree/chart/1.0.13/chart-1.0.13.pom from central Downloading: org/jfree/chart/1.0.13/chart-1.0.13.jar from central Downloading: org/jfree/chart/1.0.13/chart-1.0.13.jar from clojure Downloading: org/jfree/chart/1.0.13/chart-1.0.13.jar from clojars Downloading: org/jfree/chart/1.0.13/chart-1.0.13.jar from central An error has occurred while processing the Maven artifact tasks. Diagnosis: Unable to resolve artifact: Missing: ---------- 1) org.jfree:chart:jar:1.0.13 Try downloading the file manually from the project website.我想我需要直接下载 .jar 文件,但是一旦我有了 .jar 文件,我该如何哄 lein 为我把它放在类路径中,这样我就可以使用 emacs 等来处理它?
-
Dejcartes 示例使用
(require '[com.markmfredrickson.dejcartes :as chart]),因此我将[com.markmfredrickson/dejcartes "1.0.0"]放入我的 project.clj 中。当我运行lein deps时,这似乎开始下载一些东西,但随后它以同样的方式阻塞:C:\Users\me\code\Clojure\monty>lein deps Downloading: com/markmfredrickson/dejcartes/1.0.0/dejcartes-1.0.0.pom from central Downloading: com/markmfredrickson/dejcartes/1.0.0/dejcartes-1.0.0.pom from clojure Downloading: com/markmfredrickson/dejcartes/1.0.0/dejcartes-1.0.0.pom from clojars Downloading: com/markmfredrickson/dejcartes/1.0.0/dejcartes-1.0.0.pom from central Downloading: com/markmfredrickson/dejcartes/1.0.0/dejcartes-1.0.0.jar from central Downloading: com/markmfredrickson/dejcartes/1.0.0/dejcartes-1.0.0.jar from clojure Downloading: com/markmfredrickson/dejcartes/1.0.0/dejcartes-1.0.0.jar from clojars Downloading: com/markmfredrickson/dejcartes/1.0.0/dejcartes-1.0.0.jar from central An error has occurred while processing the Maven artifact tasks. Diagnosis: Unable to resolve artifact: Missing: ---------- 1) com.markmfredrickson:dejcartes:jar:1.0.0 Try downloading the file manually from the project website.据称从 (clojars) 下载的其中一个存储库甚至没有在大列表中显示 Dejcartes。如何让 Lein 下载 Dejcartes?
最后,鉴于我想开始使用一些包,我如何让 lein 自动查找最新版本?我还没有看到任何关于此的内容,所有 project.clj 示例似乎都对版本进行了硬编码,例如
"1.0.2"等。
非常感谢
迈克尔
【问题讨论】:
-
Leiningan 有时会因大量下载而窒息,我发现。我的处理方式如下: - 编辑 project.clj 以包含依赖项(正如您已经完成的那样)。 - 运行 lein 部门。 - 检查它是否停止(即,如果特定依赖项占用了几分钟) - 如果停止,则杀死 lein deps。 - 重新开始。如果我这样做几次,通常我可以让 lein deps 完成所有依赖项。
-
ALSO:您能否重命名此问题,以便在标题中明确您要问的内容(例如:为什么 Leiningan 在尝试获取 Dejcartes 和 JFree 项目时会失败?)
-
我澄清了这个问题。 Lein 并没有因为下载量太大而窒息;窒息是因为我放错了。
标签: clojure dependencies jfreechart leiningen