如何让Lein与JFreeChart和Dejcartes合作?

Son*_*oth 5 dependencies clojure jfreechart leiningen

我试图了解如何使用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"]])
Run Code Online (Sandbox Code Playgroud)
  1. 我看到(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.
    
    Run Code Online (Sandbox Code Playgroud)

    我想我需要直接下载.jar文件,但是一旦我有了.jar文件,我怎么哄lein把它放在classpath中给我,所以我可以使用emacs等lein swank它?

  2. 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.        
    
    Run Code Online (Sandbox Code Playgroud)

    据称从(clojars)下载的其中一个存储库甚至没有大名单中显示的Dejcartes.如何让Lein下载Dejcartes?

  3. 最后,鉴于我想开始使用一些软件包,我如何让lein自动找到最新版本?我还没有看到任何关于这个和所有project.clj示例似乎硬编码版本,例如"1.0.2"等.

非常感谢

迈克尔

Ray*_*yne 5

第一步是找出您想要获得的库的名称.如果它是一个Java库,它可能在Maven Central上.要找到答案,请访问Maven Central Search并搜索您所追求的任何图书馆.在这种情况下,我去了那里搜索JFreeChart.它给了我这个.你想要的罐子列在那里.它们分为三个相关部分:groupid,artifactid和verison.groupid是斜杠(/)之前的部分,artifactid是斜杠之后的部分,版本是......好吧,版本.把它放在一起,你就有了[jfree/jfreechart "1.0.13"].

如果你所追求的图书馆是一个Clojure图书馆,它可能是在clojars上,在这种情况下你会想去那里搜索.

要回答关于dejcartes未被发现的部分,那是因为它是一个旧的和废弃的图书馆,不是由leiningen,蛋糕,maven或其他任何东西管理的.它不在任何maven存储库中.你不能在那里找到它,除非你自己把它放在那里,完全是一个完全不同的问题.

为了回答你的第三个问题,莱宁根有一个search搜索各种回购物的任务.Cake目前在搜索clojars方面也有类似的东西,但我可能会根据更一般的Leiningen代码重写它.