Fork me on GitHub

FYI, I have used deps.edn to start both Clojure/Java and ClojureScript/Node.js REPLs, and run tests for each, for the core.rrb-vector that I have been experimenting with some proposed bug fixes for, here:


It basically uses a bunch of aliases, some prefixed with ":clj-" and others with ":cljs-", for similar functionality in each Clojure flavor. The best alternative I could imagine to that approach would be to have two different directories with different deps.edn files, one for Clojure/Java, the other for ClojureScript.


Certainly open to other ideas if anyone thinks of improvements to that approach.

Felipe Cortez21:08:16

should add-lib work for every lib or are there limitations?

(require '[ :refer [add-lib]])
(add-lib 'cheshire {:mvn/version "5.9.0"})
(require '[cheshire.core :as json])
fails with
Syntax error (ClassNotFoundException) compiling new at (cheshire/factory.clj:57:11).
Syntax error compiling at (cheshire/core.clj:1:1).
namespace 'cheshire.factory' not found


Does it work if you include it in your deps.edn?


I ran into something like this with clj-new and the Luminus template... as I recall it's a peculiarity of the Jackson library as far as its dependencies go...


(or maybe it's a bug in how Cheshire is packaged?)


I ended up needing to explicitly depend on various Jackson libraries in order to get that to succeed...

Alex Miller (Clojure team)21:08:17

add-lib will interpret new libraries in the context of your existing libs

Alex Miller (Clojure team)21:08:44

so if you already have an existing version of jackson on the classpath, and you add cheshire, it (can't) override the versions you already have

Alex Miller (Clojure team)21:08:00

if cheshire needs a newer version than the one you have, it may not work

Alex Miller (Clojure team)21:08:35

whereas if you had run a deps resolution on the full set of deps, it might have been able to resolve to a better set of deps

Alex Miller (Clojure team)21:08:55

jackson tends to be involved in 75% of dependency conflicts, so it's always a likely culprit


Yeah, that sounds like the problem -- Cheshire/Jackson version mismatches.

Alex Miller (Clojure team)21:08:08

this is a totally normal thing that can happen with add-libs


S3 wagon lib pulls in Jackson 2.5.5

Felipe Cortez21:08:37

makes sense, thanks!


@clojurians884 Here's a combination that works:

(! 508)-> clj -A:deps -Sdeps '{:deps {com.fasterxml.jackson.core/jackson-core {:mvn/version "2.7.5"}}}'
Clojure 1.10.1
user=> (require '[ :refer [add-lib]])
user=> (add-lib 'cheshire {:mvn/version "5.6.3"})
user=> (require 'cheshire.core)


Note the Jackson override on the command line. Without that, it won't work.

Felipe Cortez21:08:23

awesome! thanks for the help 🙂


You don't need to add-lib on the smile sub-lib either (edited to remove that)


If you want to use the latest Cheshire, you need Jackson 2.9.9:

(! 510)-> clj -A:deps -Sdeps '{:deps {com.fasterxml.jackson.core/jackson-core {:mvn/version "2.9.9"}}}'
Clojure 1.10.1
user=> (require '[ :refer [add-lib]])
user=> (add-lib 'cheshire {:mvn/version "RELEASE"})
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See  for further details.
user=> (require 'cheshire.core)


(I would love to excise Cheshire and Jackson from our code base for exactly this reason!)


(and the problem is because tools.deps brings in s3-wagon-private which in turn brings in Jackson 2.5.5 so you need an explicit override to make it all work)

Felipe Cortez22:08:28

do you recommend using data.json instead?

Alex Miller (Clojure team)22:08:55

I've got a spike of some work to use the cognitect s3 lib completely in place of the s3 wagon for tools.deps, would love to shift things over, but needs some work still (and prob streaming support in the s3 lib)

Alex Miller (Clojure team)22:08:29

I think the cognitect stuff uses data.json, which is definitely not as fast as cheshire/jackson (but way less problematic)


If data.json does what you need -- and does it fast enough -- then, yes, use it instead of Cheshire to avoid the pit of dependency hell that is Jackson 🙂 But, in reality, you'll find it hard to avoid Cheshire as other libraries bring it in too...


(having said that, I'm now having a hard time finding a single library that depends on Cheshire! oh how I wish that was still alive!)


(it was without - I think but that brings up an online casino that is squatting on the domain!)

Felipe Cortez22:08:47

again, thanks for the help 😄