Reputation: 1845
I am trying to add a dependency to id.walt/waltid-ssikit
a deps.edn
. However, when I download the dependencies, it cannot resolve all dependencies:
Error building classpath. Unable to resolve org.webjars.npm/babel__highlight version: [8.0.0-alpha.1,9)
It does work when I add the dependency to a pom.xml
. Maven doesn't seem to try to resolve the missing webjar dependency.
I am having the issue when using this deps.edn
:
{:mvn/repos
{"waltid" {:url "https://maven.walt.id/repository/waltid/"}
"waltid-ssikit" {:url "https://maven.walt.id/repository/waltid-ssi-kit/"}
"jitpack.io" {:url "https://jitpack.io/"}
"Maven central" {:url "https://repo1.maven.org/maven2"}}
:deps {id.walt/waltid-ssikit {:mvn/version "1.2308021811.0"}}}
and
clj
It returns the error, while I was expecting it resolve all dependencies.
Upvotes: 2
Views: 591
Reputation: 6666
The Clojure CLI -- using org.clojure/tools.deps
for dependency resolution -- tries to pick the latest version available that satisfies the dependencies you request. This is generally good because it is less likely to lead to conflicts (assuming libraries make some effort to be backward compatible -- which Clojure libraries generally do).
Unfortunately, in this case, that allows it to pick org.webjars.npm/babel__code-frame {:mvn/version "8.0.0-alpha1"}
which relies on a version range for org.webjars.npm/babel__highlight
-- [8.0.0-alpha1,9)
-- that has not been released yet!
The smallest change I was able to make to "fix" this was to add this dependency to your :deps
map:
org.webjars.npm/babel__code-frame {:mvn/version "7.21.4"}
This pins babel__code-frame
to 7.21.4
which makes it depend on a version of babel__highlight
that has actually been released so at least you can get a program running.
Note: it may be that you'll have a mix of 8.0.0-alpha1 and 7.x versions of org.webjars.npm/*
libraries which are not compatible. If that turns out to be the case, run clojure -X:deps tree
and see what other org.webjars.npm/*
stuff seems to be bringing in 8.0.0-alpha* versions and use https://search.maven.org to find earlier non-alpha versions to depend on.
Version ranges are terrible (but that npm
stuff seems to be full of them).
Upvotes: 4