Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure CLI by

Does tools.deps treat a version (e.g. 1.2.3) as a range (i.e. [1.2.3,)) like Maven and Gradle or like a fixed version (i.e. [1.2.3])? In addition, Maven has the concept of "soft" versions where the specified version is "preferred". Does tools.deps have a similar concept?

1 Answer

+1 vote
by
selected by
 
Best answer

No, tools.deps versions specify an exact version only, no ranges, no soft versions:

$ clj -Sdeps '{:deps {org.clojure/data.json {:mvn/version "2"}}}' -Stree
Error building classpath. Could not find artifact org.clojure:data.json:jar:2 in central (https://repo1.maven.org/maven2/)
$ clj -Sdeps '{:deps {org.clojure/data.json {:mvn/version "2.5"}}}' -Stree
Error building classpath. Could not find artifact org.clojure:data.json:jar:2.5 in central (https://repo1.maven.org/maven2/)
$ clj -Sdeps '{:deps {org.clojure/data.json {:mvn/version "2.5.0"}}}' -Stree
org.clojure/clojure 1.11.3
  . org.clojure/spec.alpha 0.3.218
  . org.clojure/core.specs.alpha 0.2.62
org.clojure/data.json 2.5.0

But note of course that you only control the versions if you are the top project - transitive versions can always be overridden from above.

...