Hello! Is it possible to get another version of a library you specify using {:deps {my-lib/name {:mvn/version "X"}}}?
Just for the record, rama is not going to support this. Conversation https://clojurians.slack.com/archives/C05N2M7R6DB/p1759604230258859
that’s super understandable but would be nice if they would shade the deps so you can still use what you like
I'm getting an error when starting my project
clj -X:server:server/dev
Syntax error compiling at (taoensso/timbre/appenders/core.cljc:50:17).
No such var: enc/println-atomic
So, I started analyzing the output of clj -X:deps tree :aliases "#{:server :server/dev}".Just showing what's relevant:
com.taoensso/encore 3.118.0
com.taoensso/carmine 3.4.1
X com.taoensso/encore 3.112.0 :use-top
com.rpl/rama 0.22.0
X com.taoensso/encore 3.66.0 :use-top
This output means I'll get 3.118.0 right? 🤔The thing is I'm sure 3.118.0 exposes https://github.com/taoensso/encore/blob/v3.118.0/src/taoensso/encore.cljc#L7871
what’s the output of
(enumeration-seq (.. (Thread/currentThread) getContextClassLoader (getResources "taoensso/encore.cljc")))also this to see if there are any aot versions on the classpath
(enumeration-seq (.. (Thread/currentThread) getContextClassLoader (getResources "taoensso/encore__init.class")))This is the ouput
+user=> (enumeration-seq (.. (Thread/currentThread) getContextClassLoader (getResources "taoensso/encore.cljc")))
(#object[java.net.URL 0x7f8633ae "jar:file:/home/self/.m2/repository/com/taoensso/encore/3.118.0/encore-3.118.0.jar!/taoensso/encore.cljc"])
+user=> (enumeration-seq (.. (Thread/currentThread) getContextClassLoader (getResources "taoensso/encore__init.class")))
(#object[java.net.URL 0x8d7b252 "jar:file:/home/self/.m2/repository/com/rpl/rama/0.22.0/rama-0.22.0.jar!/taoensso/encore__init.class"])
Looks ilke rama's version is being used? 🤔yeah. that comes down to classpath order which one it hits first. but fundamentally rama has an AOT’d version in a library and they are not playing nice in the jvm world
if needed to be bundled inside you should shade it (rename it so there’s no collision like this) or just depend on it and not bundle it inside of your jar.
Ughh, thanks
bummer. maybe you can open an issue with rama. But the easiest way forward is to pin your own explicit dependency to the same version as rama until they fix it
Nah, it's fine. I'm just happy with an answer. I'll be more careful on taking assumptions based on -X:deps tree. Thanks 🙏
i think your assumption is usually fine. the way it is supposed to work is everyone lists their dependencies and collisions can be handled and sorted. the tree shows duplicates and how they are resolved. but if a jar puts classfiles inside of it and doesn’t say it’s using it, they can’t be excluded and you end up with duplicates like this.
Got it 👍 . I just printed the classpath and see what you mean:
com/rpl/rama/0.22.0/rama-0.22.0.jar
com/taoensso/carmine/3.4.1/carmine-3.4.1.jar
com/taoensso/encore/3.118.0/encore-3.118.0.jar
Rama appears before encoreI'd still file an issue with Rama though. AOT-ing other libraries is usually a mistake