cursive

2025-06-07T18:53:44.635469Z

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.

onetom 2025-06-10T01:58:05.888519Z

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

👍 2
2025-06-07T18:58:17.420649Z

I’m curious why you need a stable nrepl port if you want to run from IntelliJ.

2025-06-07T18:58:46.921159Z

Dont have to explain though. Just idle curiosity.

2025-06-07T19:00:27.162729Z

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.

dpsutton 2025-06-07T19:13:31.268279Z

(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 control

1
2025-06-07T19:16:18.423609Z

That's a good idea.

dpsutton 2025-06-07T19:17:02.257149Z

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.

👍 1
dpsutton 2025-06-07T19:18:31.659109Z

This lets your main stay whatever you currently have it as and just start it up

2025-06-07T19:35:18.336199Z

The beauty of clojure.