简体   繁体   English

Leiningen 中的本地依赖项而不创建 Maven 存储库?

[英]Local dependencies in Leiningen without creating a Maven repo?

I'm building a Compojure web application, and I'd like it to use functions from another Clojure project I wrote.我正在构建一个 Compojure Web 应用程序,我希望它使用我编写的另一个 Clojure 项目中的函数。 I'm not at all familiar with Maven, and from what I've heard, it has a very steep learning curve.我对 Maven 一点也不熟悉,而且据我所知,它的学习曲线非常陡峭。 Unfortunately, everything I've seen suggests using a private Maven repo as a dependency and doesn't suggest an alternative.不幸的是, 我所看到一切都建议使用私有 Maven 存储库作为依赖项,并且没有建议替代方案。 I'd really like to avoid struggling with Maven if possible.如果可能的话,我真的很想避免与 Maven 斗争。 Does anyone know of an alternative?有谁知道替代方案? I'm currently using the latest version of Leiningen.我目前正在使用最新版本的 Leiningen。

If the other project is also a lein project, you just need to do a "lein install" and that will take care of creating all the local maven repo stuff.如果另一个项目也是一个 lein 项目,你只需要做一个“lein install”,这将负责创建所有本地 maven repo 的东西。 Then you can just depend on that project as you would do with any other lib.然后,您可以像使用任何其他库一样依赖该项目。 For example:例如:

 (defproject mylib "1.0"
      ....)

  lein install

  (defproject myotherproject "a.b.c"
     :dependencies [[mylib "1.0"]]
     .....)

If you are sharing "myotherproject" with other people and you want to remove some of the inconvenience of doing a "lein install" every time you change the mylib project, have a look at the lein checkouts feature and then use the equivalent of svn externals of your VCS of choice.如果您与其他人共享“myotherproject”,并且您想消除每次更改 mylib 项目时执行“lein install”的一些不便,请查看lein checkouts功能,然后使用等效的svn externals您选择的 VCS。

'lein checkout' appears to be another way to achieve the same goal. “lein checkout”似乎是实现相同目标的另一种方式。 a lot more details here and here .更多细节在这里这里 In general, the idea is to create a symlink to the local copy of the dependency, but the process does require one lein install .一般来说,这个想法是为依赖项的本地副本创建一个符号链接,但该过程确实需要一个lein install I also found this lein plugin that might be even better, but I've yet to try it myself.我还发现这个lein 插件可能更好,但我自己还没有尝试过。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM