问题描述
我现在要做的是打开project.clj,在那里添加依赖,运行lein deps
重新启动repl,然后use
,require
等等
What I do now is open project.clj, add dependency there, run lein deps
restart repl, then use
, require
and so on.
问题是我真的不喜欢重新启动 repl,因为启动时间很慢而且我必须再次重新加载我的文件.
The thing is that I don't really like to restart repl because the startup time is slow and I have to reload my files again.
那么有没有更好的方法给lein项目添加依赖呢?不重启repl?
So is there a better way to add dependency to lein project? without restarting the repl?
推荐答案
您可以使用 Alembic,一个动态类路径加载器和依赖项解析器.好消息是它不会加载所有 pomegranate 依赖项.
You can use Alembic, a dynamic classpath loader and dependencies resolver. The good thing is that it doesn't load all pomegranate dependencies.
将以下内容添加到您的 .lein/profiles.clj
:
Add the following to your .lein/profiles.clj
:
{:user
{:dependencies [[alembic "0.3.2"]]}}
然后在您的 Repl 中加载您需要的类路径,如果需要,它们将通过 lein
从存储库中提取:
Then in your Repl just load the classpaths you need, they will be pulled from the repositories by lein
if need:
(require 'alembic.still)
(alembic.still/distill '[enlive "1.1.5"])
(require 'net.cgrand.enlive-html)
现在应该可以工作了.
(require 'net.cgrand.enlive-html)
should now work.
这篇关于有什么方法可以在不重启 REPL 的情况下向 lein 项目添加依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!