This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-30
Channels
- # aleph (15)
- # announcements (4)
- # aws (2)
- # bangalore-clj (7)
- # beginners (236)
- # calva (24)
- # cider (11)
- # cljs-dev (63)
- # clojure (141)
- # clojure-europe (3)
- # clojure-india (2)
- # clojure-italy (8)
- # clojure-nl (3)
- # clojure-spec (8)
- # clojure-uk (52)
- # clojured (1)
- # clojuredesign-podcast (4)
- # clojurescript (35)
- # clojutre (3)
- # community-development (1)
- # cursive (77)
- # data-science (1)
- # datomic (3)
- # emacs (13)
- # fulcro (7)
- # graalvm (78)
- # graphql (2)
- # nrepl (7)
- # off-topic (18)
- # pathom (25)
- # reagent (12)
- # reitit (31)
- # shadow-cljs (178)
- # spacemacs (7)
- # tools-deps (32)
- # xtdb (10)
- # yada (3)
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: https://github.com/jafingerhut/core.rrb-vector/blob/proposed-fixes-for-4-issues/deps.edn
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.
should add-lib
work for every lib or are there limitations?
(require '[clojure.tools.deps.alpha.repl :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).
com.fasterxml.jackson.core.async.ByteArrayFeeder
Syntax error compiling at (cheshire/core.clj:1:1).
namespace 'cheshire.factory' not found
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...
add-lib will interpret new libraries in the context of your existing libs
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
if cheshire needs a newer version than the one you have, it may not work
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
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.
this is a totally normal thing that can happen with add-libs
S3 wagon lib pulls in Jackson 2.5.5
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 '[clojure.tools.deps.alpha.repl :refer [add-lib]])
nil
user=> (add-lib 'cheshire {:mvn/version "5.6.3"})
true
user=> (require 'cheshire.core)
nil
user=>
Note the Jackson override on the command line. Without that, it won't work.
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 '[clojure.tools.deps.alpha.repl :refer [add-lib]])
nil
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.
true
user=> (require 'cheshire.core)
nil
user=>
(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)
do you recommend using data.json
instead?
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)
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 http://cross-clj.info was still alive!)
(it was without -
I think but that brings up an online casino that is squatting on the domain!)
again, thanks for the help 😄