Global exclusions are not inherited
Given the following project files:
; parent/project.clj
(defproject parent-project "1.0.0"
:managed-dependencies [[org.apache.httpcomponents/httpclient "4.5.11"]]
:exclusions [commons-logging])
; child/project.clj
(defproject child-project "1.0.0"
:dependencies [[org.apache.httpcomponents/httpclient]]
:plugins [[lein-parent "0.3.7"]]
:parent-project {:path "../parent/project.clj"
:inherit [:managed-dependencies :exclusions]})
When running lein deps :tree in the child project, it currently prints:
[clojure-complete "0.2.5" :exclusions [[org.clojure/clojure]]]
[nrepl "0.6.0" :exclusions [[org.clojure/clojure]]]
[org.apache.httpcomponents/httpclient "4.5.11"]
[commons-codec "1.11"]
[commons-logging "1.2"]
[org.apache.httpcomponents/httpcore "4.4.13"]
But the expected behaviour would be for the :exclusions to be inherited, so that the child project's dependencies would be:
[clojure-complete "0.2.5" :exclusions [[commons-logging] [org.clojure/clojure]]]
[nrepl "0.6.0" :exclusions [[commons-logging] [org.clojure/clojure]]]
[org.apache.httpcomponents/httpclient "4.5.11" :exclusions [[commons-logging]]]
[commons-codec "1.11"]
[org.apache.httpcomponents/httpcore "4.4.13"]
(Leiningen 2.9.1 on Java 13 Java HotSpot(TM) 64-Bit Server VM)
Thanks for the bug report. I'm not quite sure what is causing this. When I run lein parent from child-project, lein-parent correctly reports the keys and values that it is attempting to inherit.
$ lein parent
Inheriting properties [:managed-dependencies :exclusions] from ../parent-project/project.clj
{:managed-dependencies
[[org.apache.httpcomponents/httpclient "4.5.11"]],
:exclusions [commons-logging]}
My suspicion is that something weird is happening in meta-merge when lein-parent actually modifies child-project's project map.
(defn middleware [project]
(if-let [inherited (parent/inherited-properties project)]
(with-meta (meta-merge project inherited)
(update (meta project) :profiles merge (:profiles inherited)))
project))
Perhaps meta-merge has special-case logic for :exclusions? Or maybe it's a plugin middleware ordering issue? Any ideas?
It seems to be related to leiningen.core.project/add-global-exclusions modifying the :dependencies based on :exclusions. I wonder if there is a way to run the plugin before Leiningen does that processing?