leiningen - 如何添加本地jar的依赖项? [英] leiningen - how to add dependencies for local jars?

查看:239
本文介绍了leiningen - 如何添加本地jar的依赖项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用leiningen来构建和开发我的clojure项目。有没有办法修改project.clj,让它从本地目录中挑选一些jars?



我有一些专有的jars无法上传到公共库。 p>

此外,leiningen可以用于为clojure项目维护一个lib目录吗?如果一堆我的clojure项目共享相同的jar,我不想为每个他们保持单独的副本。



感谢

解决方案

你可以把你的私人jar在 lib / ,他们将在classpath为目的 lein swank 等;这似乎打败了使用依赖关系管理工具的点,虽然如果你实际上不想管理这些依赖,你可以把Leiningen作为一个开源依赖管理工具,也许要小心 lein clean



随着情况变得更加复杂 - 涉及到更多的私人jars进化,你需要考虑他们的一些版本化信息 - Arthur的创建一个私人Maven回购的想法可能更合适。






(HR表示Leiningen特定的部分截点...继续下面有关Clojure土地中的一般构建/依赖管理工具故事的信息,包括一些我认为可能非常方便的链接



此外,对于Clojure最好的构建工具,Leiningen ,同时获得了心灵分享,也不断获得在地区的特点和抛光 - 意思,特别是,它还没有完成。这里是Stuart Halloway,Pragmatic Bookshelf的Programming Clojure的作者:我的2c:Leiningen是一个重要的步骤,但还有很多事要做。对于完整的发布和一个非常有趣的讨论re:在Clojure空间中的构建工具等,请参阅 Leiningen,Clojure和库:我错过了什么? Clojure Google组中的线程。许多参与者特别提到需要有本地依赖性不包含在任何存储库,本地或其他,并详细说明他们为这种情况下提出的解决方案。也许你可以看到,有什么,在那里可以解决你的问题现在/可以解决它在未来,当功能集成熟?



无论如何,Leiningen可能不会有一个好的故事准备好了,但对于一些复杂的场景。如果你觉得这可能是你的情况(我的意思是在你考虑私人回购的想法),这里有一些链接到基于maven的替代品,从上面提到的线程: polyglot maven clojure-maven-插件; 此博客帖子旨在帮助尝试使用maven与Clojure。我记得,Meikel Brandmeyer(也在他的在线kotarak的手柄下)使用Gradle(一个Groovy构建系统)与一个插件,以容纳Clojure称为Clojuresque;我从来没有尝试过自己,因为不知道Groovy的第一件事,但他声称运行一个非常好的建筑行为,它和我相信它与maven无关 - 这是一个加号和本身为我们的一些人。 : - )


I want to use leiningen to build and develop my clojure project. Is there a way to modify project.clj to tell it to pick some jars from local directories?

I have some proprietary jars that cannot be uploaded to public repos.

Also, can leiningen be used to maintain a "lib" directory for clojure projects? If a bunch of my clojure projects share the same jars, I don't want to maintain a separate copy for each of them.

Thanks

解决方案

You could put your private jars in lib/ and they'd be on the classpath for the purposes of lein swank and the like; this does seem to defeat the point of using a dependency management tool, though if you don't actually want those dependencies managed, you could treat Leiningen as an "open source dependencies management tool" and maybe be careful with lein clean.

As the situation becomes more complex -- there's a larger number of private jars involved, they evolve and you need to take some versioning info on them into account -- Arthur's idea of creating a private Maven repo may be more appropriate.


(The HR signifies Leiningen-specific part cut-off point... Continue below for information on the general build / dependency management tooling story in Clojure land, including some links which I think could come in very handy in your situation.)

Also, as of yet, there is no universal agreement on the question of which is the best build tool for Clojure, and Leiningen, while gaining in mindshare, is also constantly gaining in the areas features and polish -- meaning, in particular, that it's not yet complete. Here's a quote from Stuart Halloway, the author of Pragmatic Bookshelf's "Programming Clojure": "My 2c: Leiningen is an important step, but there is still plenty to do." For the full posting and a very interesting discussion re: build tools and the like in Clojure space, see the Leiningen, Clojure and libraries: what am I missing? thread on the Clojure Google group. Many participants specifically mention the need to have local dependencies not contained in any repositories, local or otherwise, and elaborate on the solutions they've come up with for such scenarios. Perhaps you could see if there's anything over there which can solve your problem now / might solve it in the future, when feature sets mature?

Anyway, it is possible that Leiningen may not in fact have a good story ready yet for some complex scenarios. If you feel this may be true of your case (and I mean after you consider the private repo idea), here's some links to maven-based alternatives taken from the above mentioned thread: polyglot maven, clojure-maven-plugin; this blog posting aims to be useful to people trying to use maven with Clojure. As I recall, Meikel Brandmeyer (also on SO under his online handle of kotarak) uses Gradle (a Groovy build system) with a plugin to accomodate Clojure called Clojuresque; I never tried it myself, as don't know the first thing about Groovy, but he claims to run a very nice building act with it and I believe it's got nothing to do with maven -- something which is a plus in and of itself for some of us. :-)

这篇关于leiningen - 如何添加本地jar的依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆