How to do pomegranate hot-loading in lein? (Java 10)


#1

EDIT: I was able to get this to work by bringing back some old pull request for Pomegranate which wasn’t added due to the corresponding nREPL change. More details here. Weird.

I’m trying to get hot-loading dependencies working. I can get a new library visible in some classloader, but still can’t require it:

PS C:\Users\Jack\SSD\Projects\classloaders-201> lein run -m nrepl.cmdline --interactive
nREPL server started on port 53159 on host 127.0.0.1 - nrepl://127.0.0.1:53159
nREPL 0.5.3
Clojure 1.10.0
Java HotSpot(TM) 64-Bit Server VM 10.0.1+10
Interrupt: Control+C
Exit:      Control+D or (exit) or (quit)
user=> (require 'bidi.bidi)
Execution error (FileNotFoundException) at user/eval1282 (form-init7649922705840423474.clj:1).
Could not locate bidi/bidi__init.class, bidi/bidi.clj or bidi/bidi.cljc on classpath.
user=> (require '[cemerick.pomegranate :as pg])
nil
user=> (pg/add-dependencies :coordinates '[[bidi "2.1.5"]]
                     :repositories (merge cemerick.pomegranate.aether/maven-central {"clojars" "https://clojars.org/repo"}))
{[bidi "2.1.5"] #{[prismatic/schema "1.1.7" :exclusions [[org.clojure/tools.reader]]]}, [prismatic/schema "1.1.7" :exclusions [[org.clojure/tools.reader]]] nil}
user=> (require 'bidi.bidi)
Execution error (FileNotFoundException) at user/eval1756 (form-init7649922705840423474.clj:1).
Could not locate bidi/bidi__init.class, bidi/bidi.clj or bidi/bidi.cljc on classpath.
user=>

Versions:

  • Windows 10 (can’t use ‘clj’)
  • lein version: Leiningen 2.8.3 on Java 10.0.1 Java HotSpot™ 64-Bit Server VM
  • Lein’s nREPL 0.5.3 (matches version in nREPL example)
  • tried both lein repl and lein run -m nrepl.cmdline --interactive (similar to nREPL docs)
(defproject jc776/classloaders-201 "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.10.0"]
                 [org.slf4j/slf4j-simple "1.7.25"]
                 [com.cemerick/pomegranate "1.1.0"]])