Fork me on GitHub
#beginners
<
2023-04-17
>
Eduardo Lopes11:04:42

I'm using cursive and Intellij and trying to setup a project using Clojure CLI, but I'm not finding how I can setup the nREPL from cursive to start on a specified namespace. On https://nrepl.org/nrepl/usage/server.html I couldn't find something similar as :init-ns from Leiningen. Does anyone know how to do it?

delaguardo11:04:24

Clojure CLI doesn't have such control. But when clojure starts the REPL, it loads user namespace at the very beginning. Typical setup would be to create something like dev/user.clj file with:

(ns user)

(require 'your.init.namespace)
(in-ns 'your.init.namespace)
Then you might want to add an alias in deps.edn:
:dev {:extra-paths ["dev"]}
Configure Cursive to use that alias for starting the REPL

Eduardo Lopes12:04:29

I tried this and din't work 😕. Not sure if I done something wrong but debugging de nREPL output the command that is executed is something like:

java -Dclojure.libfile=<path>.libs "<params-like-useragent>" clojure.main -i <path-to-private-var-folder>.clj
I was expecting something more like clj -M:nREPL -m nrepl.cmdline (following the doc) or clj -M:dev (following your instructions) Interesting that I did not check the clojure.main execution but it appears on the command

delaguardo13:04:37

odd, looks like your repl starts correctly but for some reason in-ns doesn't work

michaelrkytch16:04:49

You may want to ask in the #C0744GXCJ channel.

Eduardo Lopes16:04:04

I'll do that. Thanks for the suggestion