How can I run REPL socket in Clojure 1.8 from leiningen or boot?

In the following link http://clojure.org/reference/repl_and_main#_launching_a_socket_server

he has detailed information on how to start the REPL form java socket, but since I use lein, so how to start with lein. If starting with the download works well, I might as well try using the download.

+7
clojure
source share
2 answers

To start a socket replica, you need to pass this parameter to the JVM

-Dclojure.server.repl="{:port 5555 :accept clojure.core.server/repl}" 

In Leiningen, add this to your project.clj .

 :jvm-opts ["-Dclojure.server.repl={:port 5555 :accept clojure.core.server/repl}"] ; notice that the map is not quoted. 

and in Boot, export the BOOT_JVM_OPTIONS environment BOOT_JVM_OPTIONS

 export BOOT_JVM_OPTIONS='-Dclojure.server.repl="{:port 5555 :accept clojure.core.server/repl}"' 

Once your REPL is running, you can start telnet from another terminal to connect to the REPL connector. REPLception!

 $ telnet 127.0.0.1 5555 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. user=> (+ 1 1) 2 user=> 
+12
source share

boot has an upcoming socket-server task . Starting with version 2.7.1, a version that includes this task has not yet been released.

In the meantime, you can use the following commands to start the Socket REPL. To start a Clojure process listening on a Socket REPL on port 50505 using a boot, use:

 boot -i "(do (require 'clojure.core.server) (clojure.core.server/start-server {:port 50505 :name :repl :accept 'clojure.core.server/repl}))" wait 

Using Leiningen:

 JVM_OPTS='-Dclojure.server.myrepl={:port,50505,:accept,clojure.core.server/repl}' lein repl 

Using Clojure jar pain:

 java -Dclojure.server.myrepl="{:port 50505 :accept clojure.core.server/repl}" -jar ~/.m2/repository/org/clojure/clojure/1.8.0/clojure-1.8.0.jar 
+1
source share

All Articles