in Leiningen, we use
[xxx "1.0.0" :scope "provided"]
how to do this with tools.deps
?
in Leiningen, we use
[xxx "1.0.0" :scope "provided"]
how to do this with tools.deps
?
You can provide :scope "provided"
(or "test"
or whatever) in deps.edn
but the Maven API on which tools.deps
is based doesn’t propagate it to transient dependencies so the general advice is “use aliases instead of scopes”.
In other words, where you might use :scope "test"
in Leiningen/Boot, with clj
/ tools.deps
you would have a :test
alias that introduced :extra-deps
that you need for testing etc.
Take a look a my ~/.clojure/deps.edn file for some ideas about using aliases to bring in different dependencies and/or invoke certain Clojure -main
programs.
this dot-clojure
is a great example.
I wonder is there any aliases have some special meaning like dev
or repl
in leiningen
, or there’s no magic stuff?
I think the document is great, but there’s only few examples and they locate in different places.
No aliases have any special meaning. There’s no magic.
I maintain core.cache, core.memoize, and java.jdbc, and I recently removed their project.clj
files and added deps.edn
files instead. Running tests is just:
clj -A:test:runner
And if I want to use a specific Clojure version:
clj -A:test:runner:1.8
So multi-version testing is as simple as:
for v in 1.6 1.7 1.8 1.8 master; do clj -A:test:runner:$v; done
Starting a Socket server REPL (on port 5555) with the src/tests/clojure/
folder on the classpath, that I can connect to with unravel
:
clj -A:test:socket
Relies on my ~/.clojure/deps.edn
for the :socket
alias – the :test
alias will come from the project’s deps.edn
if present, else default to my ~/.clojure/deps.edn
version.
Starting an nREPL server (on port 5555) with ProtoREPL, so I can connect to it from Atom:
clj -A:test:proto:nrepl
It’s a really well thought out piece of tooling.