Is it possible to add new stuff to the classpath (e.g. editing project.clj and running lein deps
) and then importing it to an existing Clojure session?
This is, without having to disconnect and then connect again.
You can use pomegranate to download new libraries and add them to your classpath at runtime. It won't read directly from your project.clj, but does use a compatible syntax (using the Aether library which Leiningen 2 uses for its own dependency resolution).
Usage looks like so (quoting the README's example):
=> (add-dependencies
:coordinates '[[incanter "1.2.3"]]
:repositories (merge cemerick.pomegranate.aether/maven-central
{"clojars" "http://clojars.org/repo"}))
That said, you do have to have pomegranate itself in your initial classpath before it can be used.