CIDER: How do you experiment with libraries using REPL-driven dev?

Hi guys, I’m doing something wrong.

I’m using CIDER and I have a nice REPL set up, however I find out that I need a library of some sort, so I add it to my project.clj config, and then to my ns form. I run
lein do clean, compile

Finally, I eval the form and boom I get an exception:
1. Unhandled java.io.FileNotFoundException
Could not locate honeysql/core__init.class, honeysql/core.clj or
honeysql/core.cljc on classpath.

Now, my reaction is to restart the REPL, so I hit ",: and then type “restart” in the mini buffer. However, I still get the exception above when I try to eval the ns form. So I have to do an “adios” and start a new cider repl. Meanwhile the lein repl runs without complaints.

It is usually not a biggie as I try to store as little state as possible in the repl and try to type out as much as possible using comment or _# in a file, but I think it would be more seamless not to restart the repl at all and just do a reload of some sort.

Injecting dependencies into a running program isn’t something that is very well supported by the JVM.

There are attempts to do this in Clojure, with various levels of success. I have used them in the past, especially for just messing around and trying things out.

The one for lein is called Pomegranate

And for deps.edn, you can still use Pomegranate, or you can try the add-lib branch of tools.deps.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.