This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-25
Channels
- # announcements (10)
- # babashka (21)
- # calva (8)
- # cider (6)
- # clj-commons (5)
- # clj-kondo (37)
- # cljfx (16)
- # clojure (31)
- # clojure-australia (1)
- # clojure-europe (7)
- # conjure (8)
- # cursive (3)
- # data-science (4)
- # datalevin (6)
- # datomic (18)
- # emacs (10)
- # holy-lambda (3)
- # honeysql (4)
- # humbleui (1)
- # introduce-yourself (1)
- # lsp (13)
- # malli (6)
- # portal (8)
- # scittle (5)
- # specter (1)
- # vscode (9)
- # xtdb (5)
If after being jacked-in I change the deps.edn how can I do a refresh/restart the project?
The easiest way is to jack-in again. This will kill the REPL and start and connect a new one.
If you want to load new dependencies dynamically you could use https://github.com/clojure/tools.deps.alpha/tree/add-lib3. There is a (possibly somewhat dated) article by @U064X3EF3 about it here: https://insideclojure.org/2018/05/04/add-lib/
What I do when adding dependencies is that I have this dependency in deps.edn
:
org.clojure/tools.deps.alpha {:git/url ""
:sha "83a477b305839c697666401508c395cfed29506a"}
Then I have a https://calva.io/custom-commands/ defined like so:
"calva.customREPLCommandSnippets": [
{
"key": "a",
"name": "Add selected dependency",
"snippet": "(require '[clojure.tools.deps.alpha.repl :refer [add-libs]])\\n(add-libs '{$selection})"
}
],
With that, after I have added a dependency in deps.edn
, I can select the dependency and type ctrl+alt+space a
. This will download the dependency and make it available in my REPL.Thank you for the detailed explanation! Added to the saved items :)
Something closer to reloading deps.end
is to use https://github.com/lambdaisland/classpath.
Thanks for this @pez. I was looking for this information the other day. However, I'm trying to understand the workflow for the Lambda Island classpath approach (having read the README over there). Is it that, instead of selecting the dependency and then running the custom Calva command, instead I just save the updated deps.edn, then a file watcher invokes the classpath library to pull in the new dependency and dynamically adds it to the classpath, so no REPL restart is needed? Just trying to understand this from the user's point of view. Thanks.
I've not been using the lambdaisland/classpath solution myself, actually. I have it as one of my todo:s to explore. Maybe @U07FP7QJ0 can say yes or no on that question.