Workflow for hacking on Clojure libraries using swank-clojure

╄→гoц情女王★ 提交于 2019-12-10 16:11:53

问题


Is there a typical workflow for hacking on Clojure libraries?

Say I have my application "Foo" which relies on a third-party library "Bar", which was obtained from a repository, and included in project Foo via lein deps.

Then, say I want to hack on library "Bar", so I clone it from github.

Now, I would like to hack on my local clone "Bar" while at the same time working on application "Foo" that depends on it. I would like all of the source files for "Bar" to open in Emacs along with all the source files in "Foo", using one instance of swank.

Is there an easy way to do this?

I want to alter my environment and not the project. Therefore I do not want to edit project.clj for "Foo" in order to accomplish this.

Does this require setting the classpath before starting up lein swank, or is there a better way?


回答1:


Create a checkouts directory in your Foo project and create a symlink to your clone of the Bar project inside this directory.

To quote the Leiningen FAQ:

Q: I want to hack two projects in parallel, but it's annoying to switch between them.
A: 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. 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, and the copy in checkouts will take precedence over the dependency declared in project.clj. Note that this is not a replacement for listing the project in :dependencies; it simply supplements that for convenience.



来源:https://stackoverflow.com/questions/8846706/workflow-for-hacking-on-clojure-libraries-using-swank-clojure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!