This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-21
Channels
- # announcements (1)
- # architecture (392)
- # babashka (3)
- # beginners (1)
- # calva (2)
- # cider (1)
- # clojure (30)
- # clojure-denmark (2)
- # clojure-dev (9)
- # clojure-europe (13)
- # clojure-italy (2)
- # clojure-japan (17)
- # clojure-korea (8)
- # clojure-nl (1)
- # clojure-norway (74)
- # clojure-uk (3)
- # clojurescript (6)
- # code-reviews (8)
- # conjure (1)
- # data-science (1)
- # datascript (7)
- # datomic (1)
- # fulcro (1)
- # graalvm (9)
- # humbleui (3)
- # hyperfiddle (11)
- # leiningen (4)
- # lsp (7)
- # malli (7)
- # off-topic (57)
- # other-languages (9)
- # overtone (7)
- # shadow-cljs (30)
- # sql (15)
- # squint (3)
- # timbre (3)
- # vim (6)
I've found that add-libs
doesn't work for me if I use an alias that loads a file that starts a repl via clojure.main/repl
For example
I have an alias:
:repl2 {:override-deps {org.clojure/clojure {:mvn/version "1.12.0-alpha7"}}
:main-opts
["-e" "(clojure.main/repl :print (requiring-resolve 'clojure.pprint/pprint))"]}
Then start via
clj -M:repl2
And run in this repl:
((requiring-resolve 'clojure.repl.deps/add-lib)
'io.github.nubank/morse {:git/tag "v2023.04.30.01" :git/sha "d99b09c"} ) ;; seems to do stuff and doesn't throw an error. but then:
(require '[dev.nu.morse :as morse])
;; Could not locate dev/nu/morse__init.class, dev/nu/morse.clj or dev/nu/morse.cljc on classpath.
Is there any way to make this work? [edit: simplified example]I strongly suspect that bypasses the dynamic class loader path...
This will make it work:
clj -M -e "(->>(Thread/currentThread)(.getContextClassLoader)(clojure.lang.DynamicClassLoader.)(.setContextClassLoader,(Thread/currentThread)))" -e "(clojure.main/repl :print (requiring-resolve 'clojure.pprint/pprint))"
I used to use that code with a Socket REPL to enable the old tools.deps.alpha branch with add-lib 🙂
FWIW, I start my REPL via this: https://github.com/seancorfield/dot-clojure/blob/develop/deps.edn#L58-L62
👀 1
and that "library" will start a REPL with a bunch of stuff from the classpath