tools-deps

Shantanu Kumar 2025-05-31T11:28:41.692129Z

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

seancorfield 2025-05-31T15:48:10.287379Z

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
Shantanu Kumar 2025-05-31T16:38:46.801599Z

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.

seancorfield 2025-05-31T16:57:50.530119Z

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

Shantanu Kumar 2025-05-31T17:10:40.455879Z

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.

Shantanu Kumar 2025-05-31T17:14:42.076839Z

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

Shantanu Kumar 2025-05-31T17:31:01.998749Z

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)

seancorfield 2025-05-31T17:45:41.646369Z

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

seancorfield 2025-05-31T17:48:53.709839Z

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

seancorfield 2025-05-31T17:49:25.670889Z

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

seancorfield 2025-05-31T17:50:08.900119Z

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
Shantanu Kumar 2025-05-31T17:50:54.130129Z

> 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.

seancorfield 2025-05-31T17:51:39.073829Z

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).

Shantanu Kumar 2025-05-31T17:54:43.185819Z

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