Fork me on GitHub
#chlorine
<
2020-07-15
>
jhemann23:07:55

This is not about Chlorine per se, but I am experiencing an issue starting a socket REPL using lein 2.9.1 (and also tested 2.9.4). I have this in my ~/.lein/profiles.clj

{:socket
  {:jvm-opts ["-Dclojure.server.myrepl={:port 50505, :accept clojure.core.server/repl}"]}}

jhemann23:07:21

I start the socket repl with lein with-profile +socket repl

jhemann23:07:35

But, I am getting an nREPL that starts up

jhemann23:07:01

nREPL server started on port 53093 on host 127.0.0.1 - 
REPL-y 0.4.4, nREPL 0.7.0
Clojure 1.10.1
OpenJDK 64-Bit Server VM 11.0.4+11-LTS
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

jhemann23:07:01

If I put something wrong in my profile then lein repl errors out, so I know my profile is being read. In this case, I am not seeing any errors, just getting an nREPL starting instead of the socket REPL I need for Chlorine.

jhemann23:07:33

This successfully starts a socket REPL: clojure -J-Dclojure.server.myrepl="{:port 50505, :accept,clojure.core.server/repl}"

jhemann23:07:12

But then I do not have the benefits of lein adding the source path and whatnot to what is otherwise lein-based development.

jhemann23:07:38

I am hoping someone can offer some tips on how to diagnose this.

seancorfield23:07:27

@jhemann What makes you think the Socket REPL is not being started with Leiningen?

jhemann23:07:00

Seeing the nREPL and the port being 53093. Maybe I am being dense though, and lein is starting an nREPL but also a socket REPL on the port I chose, 50505? Let me check...

seancorfield23:07:34

lein repl always starts an nREPL server and that port number is for nREPL.

jhemann23:07:23

OK, false alarm. There is a socket REPL on 50505. I was thrown off by seeing the nREPL always starting. Thanks for the quick response @seancorfield.

seancorfield23:07:27

The Socket REPL is started by Clojure, because of the JVM option -- Leiningen and nREPL know nothing about it.

seancorfield23:07:58

(one thing to be aware of: if you start lein with-profile +socket repl outside a project, it seems to only start one JVM and therefore it does not pick up the additional JVM options from the profile)

seancorfield23:07:31

(and that's one more reason that I'm glad I stopped using Leiningen back in 2015! 🙂 )