Fork me on GitHub
#leiningen
<
2023-01-10
>
grav09:01:00

Reading https://cljdoc.org/d/leiningen/leiningen/2.9.3/doc/profiles#activating-profiles it seems that dependencies aren't merged across profiles by default, but that's not what I'm seeing. If I have this simple project.clj:

(defproject lein-fun "0.1.0-SNAPSHOT"
  :dependencies [[clj-time "0.15.2"]]
  :profiles {:my-profile {:dependencies [[cheshire "5.10.2"]]}})
and run
$ lein with-profile my-profile deps :tree
I still get [clj-time "0.15.2"] as one of the top-level nodes. Am I misunderstanding the docs? Is there a way that I can exclude the "default" dependencies?

mikerod16:01:00

:dependencies by default are merged - I think nearly all keys in profiles are default merged

mikerod16:01:16

You typically have to explicitly opt-out of that sort of behavior. Not sure where you think the docs say otherwise.

mikerod16:01:30

(defproject lein-fun "0.1.0-SNAPSHOT"
  :dependencies [[clj-time "0.15.2"]]
  :profiles {:my-profile {:dependencies ^:replace [[cheshire "5.10.2"]]}})
to not merge it; or rather have your profile :dependencies override/replace during the merge instead of merging the dep vectors