Clojure 如何让Lein与JFreeChart和Dejcartes合作?

Clojure 如何让Lein与JFreeChart和Dejcartes合作?,clojure,dependencies,jfreechart,leiningen,Clojure,Dependencies,Jfreechart,Leiningen,我试图理解如何将lein与clojure一起使用,并让它在Win7 x64上下载正确的.jar文件。作为一个具体的例子,我尝试使用JFreeChart和Dejcartes 我的问题是一般性的,不是针对JfreeChart的。从根本上说,我不明白如何缩小看到使用某个特定包的示例与通过lein获得该包之间的差距。希望有人能以同样适用于其他软件包的方式回答 请参阅此链接: 我的project.clj是这样的(注释掉了这篇文章的最后两行) 我看到Dejcartes readme.txt中使用了(impo

我试图理解如何将lein与clojure一起使用,并让它在Win7 x64上下载正确的.jar文件。作为一个具体的例子,我尝试使用JFreeChart和Dejcartes

我的问题是一般性的,不是针对JfreeChart的。从根本上说,我不明白如何缩小看到使用某个特定包的示例与通过lein获得该包之间的差距。希望有人能以同样适用于其他软件包的方式回答

请参阅此链接: 我的project.clj是这样的(注释掉了这篇文章的最后两行)

  • 我看到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把它放到类路径中,这样我就可以lein使用emacs等工具对它进行swank了

  • Dejcartes示例使用
    (需要“[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自动找到最新版本?我没有看到关于这个和所有项目的任何东西。clj示例似乎对版本进行了硬编码,例如
    “1.0.2”

  • 非常感谢


    Michael

    第一步是找出您想要获取的库的名称。如果它是Java库,那么它可能位于Maven Central上。要找到答案,请访问并搜索您要查找的任何图书馆。在这种情况下,我去那里搜索JFreeChart。它给了我。你想要的罐子列在那里。它们分为三个相关部分:groupid、artifactid和verison。groupid是斜杠(/)前面的部分,artifactid是斜杠后面的部分,版本是。。。嗯,版本。把这些放在一起,就有了
    [jfree/jfreechart“1.0.13”]

    如果你要找的图书馆是Clojure图书馆,它可能是打开的,在这种情况下,你会想去那里搜索

    要回答关于dejcartes未被发现的部分,那是因为它是一个古老而废弃的图书馆,不由leiningen、cake、maven或其他任何人管理。它不在任何maven存储库中。除非你自己把它放在那里,否则你无法在那里找到它,这是一个完全不同的问题


    为了回答您的第三个问题,leiningen有一个
    搜索
    任务,用于搜索各种回购协议。Cake目前在搜索Clojar时也有类似的功能,但我可能会重写它,以更通用的Leiningen代码为基础。

    我发现,Leiningen有时会因大量下载而窒息。我的处理方法如下:-编辑project.clj以包含依赖项(正如您已经做的那样)。-运行lein deps检查它是否暂停(即,如果某个特定依赖项占用了几分钟)-如果暂停,请杀死lein deps。-重新启动。通常,如果我这样做几次,我就可以让lein deps完成所有依赖项的获取。另外:您是否可以重命名此问题,以便在标题中明确您的问题(例如:为什么Leiningan在获取Dejcartes和JFree项目时失败?),我澄清了这个问题。Lein并没有因为下载量大而窒息;它窒息了,因为我放错了。
    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.