How do I set a consistent nrepl port when running using the options shown in this image? As you can see, I have tried pretty much everything. I swear I've used :nrepl-port 7888 in my deps.edn before or some variant thereof, but maybe I'm thinking of the days of lein. I do know that I can make this work consistently with clojure -M:nrepl then setting up a remote repl config, but I'd really like to just configure the port and run the REPL from within the Cursive IDE.
u can make a .nrepl.edn file with {:port 1234} in it, if im not mistaken.
https://nrepl.org/nrepl/usage/server.html#server-configuration
I’m curious why you need a stable nrepl port if you want to run from IntelliJ.
Dont have to explain though. Just idle curiosity.
So I don't have to change the port mapping every time I need to connect with something like clojure-mcp that wants to jack in to the same port (however, that might not even work. I'm just experimenting. I would expect it to, though, since the type of repl is nrepl.). Honestly, it may be easier to just clojure -M:nrepl and we all jack in to that, but I'd like the option. One less piece of machinery.
(ns nocommit.nrepl
(:require
[nrepl.server :as server]))
(defonce server nil)
(defn start!
[]
(alter-var-root #'server
(fn [_] (server/start-server :port 7888))))
(defn stop!
[]
(when server
(server/stop-server server))
(alter-var-root #'server (constantly nil)))
(comment
(start!)
server
)
you can always add an nrepl server that you controlThat's a good idea.
This is how I expose it since I’m usually on a socket repl. I’ve also got a prototype of a socket based quick eval.
This lets your main stay whatever you currently have it as and just start it up
The beauty of clojure.