我试图了解如何将 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"]])
我看到
(import '(org.jfree.chart chartframe))
在 Dejcartes readme.txt 中使用过,所以我认为这意味着我需要 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"
等。
非常感谢
迈克尔