cursive

2025-01-28T09:40:09.388769Z

I have a deps.edn project. When I start a repl in intellij/cursive the repl starts on a random port. Is there a way for me to specify which port it is?

souenzzo 2025-01-28T11:11:33.715929Z

why do you want this? if you want to connect an external tool to cursive repl, use .nrepl-port file, available in the REPL pwd.

2025-01-28T11:14:28.047749Z

I have a monorepo and I'm running lots of applications at once and they overwrite this file. Sometimes I want to connect to one of these application repls, but the port is no longer discoverable except in the case of whichever application started most recently. If I could make it so every application's repl started on a port dedicated to that application I wouldn't have this problem.

2025-01-28T14:56:04.987469Z

You should be able to require the nrepl.server namespace and then call

(nrepl.server/start-server :bind "0.0.0.0" :port nrepl-port)
in each of your apps to set the port to whatever you want.

2025-01-28T15:00:34.026419Z

Right that would work if I was running the application stand alone. But I'm asking about when I launch it is a Clojure Repl run configuration inside cursive.

dpsutton 2025-01-28T16:07:08.036189Z

https://nrepl.org/nrepl/usage/server.html#server-configuration i think you can set a config file at the nrepl level, not necessarily at the cursive level

2025-01-28T16:29:31.928659Z

Unfortunately this doesn't help. It looks like cursive is explicitly setting a port number.