TLDR;
lein repl
starts in the namespace defined by :main
in project.clj
, instead of user
, as desired.
Details
I have a Leiningen project which is deployed as a command-line application in an uberjar, so I can run it like so:
java -jar my-app-1.0-standalone.jar --some --args
I also have a dev/user.clj
to give me a nice REPL environment, as described here.
My project.clj
looks like this:
(defproject my-app "1.0"
:main my-app.cli
:aot [my-app.cli]
:profiles {:dev {:source-paths ["src" "dev"]}})
When I start my REPL, either with lein repl
from the command line or M-x cider-jack-in
from Emacs, I am in the my-app.cli
namespace, rather than user
.
If I remove :main my-app.cli
from project.clj
, my REPL starts in the user
namespace as I'd expect, but clearly this breaks my uberjar.
Any ideas?
When lein repl task runs, it will look up the ns to switch to in this order of preference:
In your case, try adding:
:repl-options {:init-ns user}
to your project.clj
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With