tools-deps 2025-05-31

Hi, is there any equivalent of Leiningen's :pedantic? :abort in deps.edn/`clj`? https://github.com/technomancy/leiningen/blob/github/sample.project.clj#L82-L88

Alex Miller (Clojure team) 2025-05-31T14:31:38.870449Z

No

It's probably worth noting that the Leiningen needs :pedantic? :abort because it's algorithm for selecting a dependency version is more complex / more confusing than the algorithm behind deps.edn (pick the most recent). You can use clojure -X:deps tree to get insight into how competing versions are handled. FWIW, in the ~six years I've been using deps.edn, I think I've only run into one weird issue due to "most recent" version selection, whereas I ran into several problems during the same length of using Leiningen.

👍 1

Thank you for the info. Yesterday, I was troubleshooting an issue for some time that turned out to be a Ring middleware pulling in older deps. clj -X:deps tree helped track it down.

Interesting. Older deps should be ignored in favor of other newer deps, so I'm curious to hear more details about that?

I had the following earlier:

ring/ring-json {:mvn/version "0.5.1"}
 ,,,
  ring/ring-jetty-adapter {:mvn/version "1.14.1"}
This ^ caused Ring async handlers to throw (error: clojure.lang.ArityException: Wrong number of args (2) passed to: ring.middleware.json/wrap-json-response/fn--1390/fn--1391) as they are wrapped with ring-json. Adding :exclusions [ring/ring-core] to ring-json dependency fixed it.

Env: Linux, Java 21, Clojure CLI version 1.12.0.1530, Clojure: 1.12.0

BTW, I was able to emulate a makeshift pedantic-abort with a Makefile target (dependency for another target):

pedantic-abort:
	!(clj -X:deps tree | grep older-version)

Oh, because you weren't explicitly depending on ring-core 1.14.1?

Hmm, weird, when I look at those deps, I see the up-to-date ring-core as expected:

> clojure -X:deps tree :extra '{:deps { ring/ring-json {:mvn/version "0.5.1"}
 ,,,
  ring/ring-jetty-adapter {:mvn/version "1.14.1"}}}'
org.clojure/clojure 1.12.0
  . org.clojure/spec.alpha 0.5.238
  . org.clojure/core.specs.alpha 0.4.74
ring/ring-json 0.5.1
  . cheshire/cheshire 5.10.0
    . com.fasterxml.jackson.core/jackson-core 2.10.2
    . com.fasterxml.jackson.dataformat/jackson-dataformat-smile 2.10.2
      . com.fasterxml.jackson.core/jackson-core 2.10.2
    . com.fasterxml.jackson.dataformat/jackson-dataformat-cbor 2.10.2
      . com.fasterxml.jackson.core/jackson-core 2.10.2
    . tigris/tigris 0.1.2
  X ring/ring-core 1.9.2 :superseded
    X ring/ring-codec 1.1.3 :parent-omitted
    X commons-io/commons-io 2.6 :parent-omitted
    X commons-fileupload/commons-fileupload 1.4 :parent-omitted
    X crypto-random/crypto-random 1.2.0 :parent-omitted
    X crypto-equality/crypto-equality 1.0.0 :parent-omitted
ring/ring-jetty-adapter 1.14.1
  . ring/ring-core 1.14.1 :newer-version
    . org.ring-clojure/ring-core-protocols 1.14.1
    . org.ring-clojure/ring-websocket-protocols 1.14.1

I think something else weird is going on in your project.

BTW, if you want JSON middleware that doesn't depend on Cheshire/Jackson, I created https://github.com/seancorfield/ring-data-json (uses clojure.data.json instead)

👍🏽 1

> Oh, because you weren't explicitly depending on ring-core 1.14.1? Yes, I depended upon the jetty-adapter to bring in the latest.

You don't need to exclude ring-core from ring-json in that case -- ring-jetty-adapter will provide the latest ring-core (as I showed).

Somehow, I ended up with that error (I have more deps, but not Ring related.) 🤷🏽‍♂️