I have a problem with lein javac that I don't know how to approach:
I've made a user.clj with some repl helpers, which imports my main application. This application uses a few Java classes. When the classes are already compiled, I can run lein javac. When I remove the classes then lein javac crashes with ClassNotFoundException when importing my main namespace. When I comment out all code in my user.clj it works again.
Is leiningen always loading the user namespace? I've assumed it's only used for the REPL, am I wrong?
Clojure always loads user.clj (before anything else!) if it is in your classpath
it has that special semantic
assuming that user.clj resides in dev/ which is added by a :dev profile, you could run:
lein with-profile -dev javac
...that's meant to be effectively equivalent to "commenting out user.clj" :)
Oh, that makes sense! I'll move my repl tools to another namespace, user.clj is just not the right place for them.
yeah I have them in dev/dev.clj
Thank you! I was starting to doubt my senses (the REPL would start sometimes, crash sometimes, or my favourit: Cursive would hang on something like "Calculating Classpath")
...this "special semantic" has all sorts of unintended side-effects 🙃