【问题标题】:How can I add a not-maven-compatible jar file to a leiningen project?如何将不兼容 maven 的 jar 文件添加到 leiningen 项目?
【发布时间】:2013-06-23 08:44:29
【问题描述】:

我正在尝试将 artemis 添加为我的 clojure 应用程序的依赖项。但它没有 pom 文件。所以无论有没有 lein-localrepo,我都无法将它安装到我的本地仓库中。目前我将 artemis jar 文件保存到lib/。如何在我的项目中使用它?

$ lein localrepo install -r repo/ lib/artemis-a609b2076aacc0ef5ecf0b390205d01bb88ceae2.jar com.artemis/artemis a609b2076aacc0ef5ecf0b390205d01bb88ceae2
$ lein trampoline run Retrieving com/artemis/artemis/a609b2076aacc0ef5ecf0b390205d01bb88ceae2/artemis-a609b2076aacc0ef5ecf0b390205d01bb88ceae2.pom from lib
Could not transfer artifact com.artemis:artemis:pom:a609b2076aacc0ef5ecf0b390205d01bb88ceae2 from/to lib (file:repo): no supported algorithms found
This could be due to a typo in :dependencies or network issues.

lein-localrepo 不生成 pom 文件:

$ ls -1 repo/com/artemis/artemis/
a609b2076aacc0ef5ecf0b390205d01bb88ceae2
maven-metadata-local.xml

这是我的project.clj 的相关行:

:dependencies [[org.clojure/clojure "1.5.1"]
               [com.artemis/artemis "a609b2076aacc0ef5ecf0b390205d01bb88ceae2"]]
:plugins [[lein-localrepo "0.5.0"]]
:repositories {"lib" "file:repo"}  

我没有在这个项目中使用 eclipse。

【问题讨论】:

    标签: maven clojure leiningen


    【解决方案1】:

    您可以随时将 jar 添加到本地 maven 存储库中

    Guide to installing 3rd party JARs

    即使没有可用的 pom。您只需提供一些信息,例如 groupID、版本和工件名称。

    完成此操作后,您可以像使用任何其他 maven 依赖项一样使用它。

    否则,您可以查看“Leiningen and lein-localrepo: How to create local maven repository for jar files”,它描述了与 netty 类似的问题以及如何使用 lein-localrepo 解决该问题。

    【讨论】:

    • +1 这是解决此问题的一种方法。但我正在寻找一个更简单的解决方案。不涉及本地 Maven 存储库的东西。我想签入我的 jar 文件,并在结帐时使用它。
    • 我认为您正在使用 leiningen2。 Leiningen 2 不再支持:extra-classpath-dirs。对此有一些技巧(我不会使用它)。您可以使用:resource-paths 添加您需要的罐子。在您的情况下,您可以将 :resource-paths ["lib/*"] 之类的内容添加到您的 project.cljfile 中。如前所述。这是一个 hack,我不会使用它。首选方式是使用lein-localrepo
    • 对,我使用的是 Leiningen 2.2.0。我正试图让你提到的黑客现在工作。首选方法并不能解决问题,它只是将其推出 leiningen 域。我不喜欢新开发人员在运行 lein deps 期间或之后出现错误的想法。
    • 我试过lein-localrepo,但它不起作用。我已经更新了问题。
    猜你喜欢
    • 2020-10-27
    • 2018-03-15
    • 2012-08-13
    • 1970-01-01
    • 1970-01-01
    • 2019-05-09
    • 2013-11-24
    • 1970-01-01
    • 2014-04-07
    相关资源
    最近更新 更多