简体   繁体   English

自动化Leiningen本地依赖管理

[英]Automating Leiningen local dependency management

I am using a local maven repository to house some code I am using to develop a project. 我正在使用本地maven存储库来存储我用于开发项目的一些代码。 I have cited this repository in my project.clj file, and am now able to rely on local jars in this way (how to do this in a previous question of mine). 我在我的project.clj文件中引用了这个存储库,现在能够以这种方式依赖本地jar(如何在我之前的一个问题中执行此操作)。

Since I am actively developing these projects, I have my project.clj file looking for the LATEST version. 由于我正在积极开发这些项目,因此我的project.clj文件正在寻找LATEST版本。 But, in order to update a dependency, I still have to increment the version number of that dependency and then run lein install to build it to the maven repository. 但是,为了更新依赖项,我仍然需要增加该依赖项的版本号,然后运行lein install将其构建到maven存储库。

Does leiningen have a way to do this where this is automatically done for me when I build the project that depends on things from the maven repo? 当我构建依赖于maven repo中的东西的项目时,leiningen有没有办法做到这一点? Can lein just look for those things and rebuild them as needed? lein可以只是寻找那些东西并根据需要重建它们吗?

If you want to develop two projects in parallel, with one depending on the other, you can use symlinks in a checkouts directory to avoid having to install snapshots all the time. 如果要并行开发两个项目,其中一个项目依赖于另一个项目,则可以在checkouts目录中使用符号链接以避免必须始终安装快照。

To quote from the Leiningen README : 引用Leiningen自述文件

Q: I want to hack two projects in parallel, but it's annoying to switch between them. 问:我想并行攻击两个项目,但在它们之间切换很烦人。
A: Use a feature called checkout dependencies. 答:使用名为checkout dependencies的功能。 If you create a directory called checkouts in your project root and symlink some other project roots into it, Leiningen will allow you to hack on them in parallel. 如果您在项目根目录中创建一个名为checkouts的目录,并且符号链接其他一些项目,Leiningen将允许您并行攻击它们。 That means changes in the dependency will be visible in the main project without having to go through the whole install/switch-projects/deps/restart-repl cycle. 这意味着在主项目中可以看到依赖项的更改,而无需完成整个install / switch-projects / deps / restart-repl循环。 Note that this is not a replacement for listing the project in :dependencies; 请注意,这不是将项目列在:dependencies; it simply supplements that for tighter change cycles. 它只是补充了更紧凑的变化周期。

Are your dependencies version snapshots? 您的依赖项是版本快照吗? Maven should update all *-SNAPSHOT dependencies on build automatically. Maven应该自动更新构建的所有* -SNAPSHOT依赖项。

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

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