Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting an nREPL with Clojure CLI Tools

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.

like image 371
Petrus Theron Avatar asked Mar 01 '18 11:03

Petrus Theron


People also ask

How do I start a REPL Clojure?

To start a REPL session in Eclipse, click the Menu option, go to Run As → Clojure Application. This will start a new REPL session in a separate window along with the console output.

How do I get out of Clojure REPL?

You can exit the REPL by typing Ctrl+D (pressing the Ctrl and D keys at the same time).

What is nREPL?

nREPL is a Clojure network REPL that provides a REPL server and client, along with some common APIs of use to IDEs and other tools that may need to evaluate Clojure code in remote environments.

How do I start a Clojure REPL?

The easiest way to start a Clojure REPL is with using the clj command of the Clojure CLI tools: You should see output like the following: See Getting Started to learn how to install the Clojure CLI.

How do I test nrepl against multiple versions of Clojure?

A history of nREPL builds is available, as well as a compatibility test matrix, verifying nREPL's functionality against multiple versions of Clojure and multiple JVMs. Most of the time, you will connect to an nREPL server using an existing client/tool.

How do I start a REPL using the CLJ tool?

See Deps and CLI for a complete reference. See the changelog for version information. After you download and install the tools, you can start a REPL by running the clj tool: Once in the REPL you can type Clojure expressions and press enter to evaluate them.

What is nrepl?

nREPL is a Clojure n etwork REPL that provides a REPL server and client, along with some common APIs of use to IDEs and other tools that may need to evaluate Clojure code in remote environments. nREPL is available in Maven central.


2 Answers

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.

like image 189
Bozhidar Batsov Avatar answered Sep 21 '22 06:09

Bozhidar Batsov


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.

like image 36
Petrus Theron Avatar answered Sep 20 '22 06:09

Petrus Theron