tools-deps 2026-02-15

It seems that I cannot specify the repositories to use when using clojure.repl.deps/add-lib, correct ? If so, which are used ?

seems to use the configured ones

clj -Sdeps '{:mvn/repos {"metabase-maven-downloads" {:url ""}}}'
Clojure 1.12.1
user=> (add-lib 'com.metabase/athena-jdbc {:mvn/version "3.7.0"})
[com.metabase/athena-jdbc]
user=>
vs
❯ clj
Clojure 1.12.1
user=> (add-lib 'com.metabase/athena-jdbc {:mvn/version "3.7.0"})
Execution error (ExceptionInfo) at clojure.tools.deps.interop/invoke-tool (interop.clj:81).
Could not find artifact com.metabase:athena-jdbc:jar:3.7.0 in central ()

Yes, so these cannot be changed at "runtime" ?

perhaps you could add a new one and call sync-deps?

sync deps doesn’t seem to register it

hmm In my scenario there is not 'deps.edn`. I run clojure as part of an "uberjar".... So I do indeed wonder if add-lib supports this scenario at all.

i believe those functions only work when the repl is started with clj and clojure

Is this confirmed and somehwhere written ? I searched for it, but could not really find it.

user=> (doc add-lib)
-------------------------
clojure.repl.deps/add-lib
([lib coord] [lib])
  Given a lib that is not yet on the repl classpath
repl classpath

i remember hearing it, i think they had to add some env variable set by clj and clojure that it registers

the source of add-lib contains this: procurer (select-keys (basis/current-basis) [:mvn/repos :mvn/local-repo]) and the current basis will of course only be meaningful in a process started by clj or clojure

yes... So this feature works completely different then pomegranate ?

user=> (require '[cemerick.pomegranate :as pom]
                '[cemerick.pomegranate.aether :as aether])
nil
user=> (pom/add-dependencies :coordinates '[[incanter "1.9.2"]]
                             :repositories (merge aether/maven-central
                                                  {"clojars" ""}))
;...add-dependencies returns full dependency graph here...
user=> (require '[incanter core stats charts])
nil

which does work "without repl".

yes it does work differently

just because i’m interested, why are you trying to dynamically add deps in an uberjar context?

Ok. For a while I understood it as an "clojure build in, official replacement".

In there "clojure" and "all librraies" need to be packed as an uberjar. The uberjar is the "jupyter kernel".

ah. you are kind of a runtime yourself

and it seems to work. I was just wondering about using "add-lib" instead.

Alex Miller (Clojure team) 2026-02-15T17:24:24.949829Z

I can confirm that it’s going to use the repos from deps.edn, and I don't think it will pick up new ones even if you sync-deps, although maybe that would be possible

Is that something which could be added ? Because it uses the once from the base, but it would work if we simply could specify others ? And if "specifying repos" would work, would it then allow to add libs dynamically in my scenario of using a uberjar with clojure and not the "clojure" / "clj" cli tools ? Otherwise asked : Is add-lib only supported / working 'by principle' when using the "clojure" cli ?

Alex Miller (Clojure team) 2026-02-15T17:51:45.446509Z

Can you file an ask Clojure for the repo thing?

Alex Miller (Clojure team) 2026-02-15T17:53:42.495449Z

add-libs uses the CLI so requires it, but you can also use https://github.com/nubank/lein-add-libs to source the basis from project.clj

Alex Miller (Clojure team) 2026-02-15T18:09:45.933739Z

Don’t understand the uberjar question exactly but they kind of break the model in that you lose all the info about what libs are expanded inside the uberjar. add-lib is trying to resolve new libs against the existing loaded libs, which it can no longer know

As Illustration: This jar https://github.com/scicloj/noj/releases/download/2-beta19.1/noj-2-beta19.1-uber.jar contains "clojure" (among other libraries ) I can run it as clojure repl by:

java -cp noj-2-beta19.1-uber.jar clojure.main
But inside of this repl, add-lib fails, on first sight because no repo is found, as there is no "basis". You seem to say, even if i could specify repos, it would still not work , correct ?
(add-libs '{http-kit/http-kit {:mvn/version "2.5.1"}})
Execution error (ExceptionInfo) at clojure.tools.deps.interop/invoke-tool (interop.clj:81).
Could not find artifact http-kit:http-kit:jar:2.5.1
user=> 

The use case is a bit of having a "closed world" of an uberjar, which still can be extended from "inside"... So it is "half closed".... An other "projects" uses this type of uber jars as well: https://github.com/clojupyter/clojupyter Here the "jupyter kernel" need to be an uberjar contain clojure itself. (and all libraries needed, which is inflexible)

Alex Miller (Clojure team) 2026-02-15T18:37:44.960439Z

These are not use cases add-libs is trying to cover

Thanks for confirmation.👍

Alex Miller (Clojure team) 2026-02-15T18:39:34.223889Z

It would be possible to alter the basis using the impl/non-public api in c.java.basis.impl to add repos or even describe the actual dep set

Alex Miller (Clojure team) 2026-02-15T18:40:13.309499Z

Depends how far outside the lines you want to color :)