Fork me on GitHub

Hello, I’m a bit confused. I’ve a ~/.clojure/deps.edn with a few aliases. If I cd to ~/.clojure and run clj -A:portal -Stree it finds :portal alias and prints all dependencies. However in all other directories clj does not find :portal alias and prints WARNING: Specified aliases are undeclared and are not being used: [:portal]. What I’m missing here? Using latest clojure version on macos.


Ok, clojure cli lookups for $CLJ_CONFIG first, then $XDG_CONFIG_HOME and fallbacks to $HOME/.clojure. Recently I defined XDG_CONFIG_HOME for another tool to work. So that broke clojure’s search path. Fixed by defining $CLJ_CONFIG


Or move that to ~/.config/clojure/deps.edn so it's XDG-compliant?

👍 1

I agree with Sean that .config/clojure is a more discoverable place I also moved all my Clojure dev tooling to XDG specification


In my -main function I am using print and was seeing the expected output in the terminal when running clj -M -m practice.core but not when building and running the uberjar with java -jar ... . In looking at the print docs I figured I needed to add a call to flush and sure enough that fixed it. I had read that using the clj -M -m method of running a program is equivalent to using java -jar so I'm curious if there are other small gotchas like this.


It is just not true that they are equivalent


That's what I figured. Tbf, I think that conversation was more in the line of starting a backend server. Maybe they meant in that specific instance you could use either or.

Alex Miller (Clojure team)20:08:22

You would need to share more of your code and uberjar to really say more


Eh, it's just my little practice repo. Nothing really going on there. More a curiosity than a problem.

Alex Miller (Clojure team)23:08:57

when build the uberjar, are you setting practice.core as the Main-Class ?


Yep. The code works. I was just curious about the difference between clj -M -m ... and java -jar ... as the former worked without calling (flush) and the latter did not. I am wondering what other differences there are because they are running the same function.


-M goes through there, which has a call to flush in a finally


Ahh, yep, that explains it. Cool. Thanks for sharing that


It also sets up a bunch of bindings which aot'ing your own entry point won't have


It's cool how readable the clojure source is. I imagined a ton of wild optimizations but even though some of this is over my head it seems quite approachable to me.

Alex Miller (Clojure team)04:08:01

The repl is really just calls to read eval print in a loop. So not much magic