how do I get my "prod classpath" in lein?
I'm using :test-paths ["test"] and when I run lein classpath it includes my test dir. This is not what I expect.
Update: even without :test-paths ["test"], with a almost empy project.clj, it includes test in my lein classpath
lein with-profile -user,-dev,-test classpath ?
(I haven't tried it)
I thiiiink the classpath command had some oddities that would make it still include stuff that shouldn't
I would like to get "the classpath that will be used to create the uberjar"
mostly for debug
you could also add +uberjar to the mix (although it's quite rare to add deps only in the :uberjar profile)
LMK if that command worked for you
lein show-profiles shows every profile in the project
After a
lein with-profiles -auth,-base,-checkout,-debug,-default,-leiningen/default,-leiningen/test,-offline,-uberjar,-update,-user classpath | tr ':' '\n' | head
(removing all profiles)
it still prints "test" directory 😞
...it's hardcoded.
you can have a profile named blank-test-paths that does a :test-paths ^:replace []
Is it correct to assume that if I have specified a version for a dependency defined in project.clj and multiple versions installed in ~/.m2 lein should pick the version I have specified? I ask because people on my team, myself included, have seen that installing a newer version of clojure.java-time in a project that depends on an earlier version ends up using the newer one (which is incompatible in our case).
This ended up being different behavior between java versions.
really? I would say the JVM version doesn't affect maven dependency resolution
It wasn't a dependency at all in the end, but changes in the resolution of the timestamps.
got it, yeah it has bitten me before I would use JDK8 while my team / app JDK16 so I would get some surprising behavior :)
you can start a REPL and run this code
(for [i ["java_time/api.clj"
"java_time/api.class"
"java_time/api.cljc"]
f (enumeration-seq
(.getResources
(.getContextClassLoader (Thread/currentThread))
i))]
(str f))
It should result in a list with 1 single element
that starts with jar:file, and contains the java-time version@souenzzo thanks, it shows what I would expect, so I'll need to dig in deeper to understand what exactly is going on.
lein deps :tree can help you in two ways:
• show which other dep might be depending on the different clojure.java-time version
• explictly inform you of such ambiguities (you can always ban them by setting :pedantic? :abort in your project
I consider :pedantic? a basic tenet of a nicely maintained project :)