Starting an nREPL with Clojure CLI Tools

2.7k Views Asked by At

How do I start an nREPL from the clj command?

I can't run my project using Lein or Boot because I have an unbalanced paren somewhere, and the reader complains `java.lang.RuntimeException: read-cond starting on line 13 requires an even number of forms.

2

There are 2 best solutions below

1
Petrus Theron On

Wrote a gist on how to do this:

clj -Sdeps '{:deps {org.clojure/tools.nrepl {:mvn/version "0.2.12"}}}'
Clojure 1.9.0
user=> (use '[clojure.tools.nrepl.server :only (start-server stop-server)])
nil
user=> (defonce server (start-server :port 7888))
#'user/server

Now you can connect to port 7888 using your remote REPL client. There is probably a way to do this in one line.

0
Bozhidar Batsov On

Things are easier now than they were when the question was posted:

$ clj -Sdeps '{:deps {nrepl/nrepl {:mvn/version "0.5.3"}}}' -m nrepl.cmdline

More details here.