Is it expected for Leiningen not to complain/warn about missing dependencies when building a JAR (not an uberjar)?
I have a project that requires a namespace in another Clojure library, but that Clojure library is not a direct or transitive dependency (checked with lein deps :tree). lein uberjar fails, but lein jar doesn't.
That makes sense. I just thought lein jar also did compilation.
It would do compilation if you were trying to AOT things. But that’s typically only done for uberjar.
lein jar just packages the specified code into a JAR. It doesn't load/compile it, so it wouldn't know about missing dependencies.
Whatever you specify in :dependencies will get mapped into the pom.xml that's inside the JAR.
In Maven, I think you'd specify such dependencies as provided -- i.e., to indicate the user must provide them -- but I'm not sure if you can specify that in project.clj
(I haven't used lein for years, at this point, so I'm going on memory)
I think you can do it via something like a scope, but I think the main path is to use the special :provided profile mentioned in the docs: https://codeberg.org/leiningen/leiningen/src/commit/8cda41784545bef71d1d605d739f4935c8fe4f21/doc/PROFILES.md#default-profiles