Fork me on GitHub
#tools-deps
<
2020-05-21
>
dominicm20:05:53

Silly question, what does override-deps do that extra-deps doesn't? I realized I've been using extra-deps in my deps.edn when I want to override a dep.

Alex Miller (Clojure team)20:05:43

override replaces, extra adds

Alex Miller (Clojure team)20:05:09

that is, it is ignored if you don't already have the lib

Alex Miller (Clojure team)20:05:04

I guess it would be more accurate to say override replaces and extra adds or replaces

Alex Miller (Clojure team)20:05:09

further refining... ā€¢ extra adds new top-level deps (which may effectively replace existing top or transitive deps) ā€¢ override replaces the version of an existing top or transitive dep

Alex Miller (Clojure team)20:05:04

in both cases, you should be guaranteed to get the version you've said - in extra, because it's at the top level, and in override because it replaces at all levels

seancorfield21:05:34

@dominicm For a concrete use case, we use :override-deps heavily at work to "pin" versions of libraries across our entire repo. If a particular app doesn't use a given dependency, the :override-deps does nothing. For deps we expect to be overridden, we specify the coords as just {} (since they'll be supplied via the override). Does that help?

seancorfield21:05:25

In a community context: https://github.com/seancorfield/dot-clojure/blob/master/deps.edn#L4-L17 -- those aliases let you pick a specific version of Clojure by overriding whatever would otherwise be pulled in.

dominicm21:05:49

Cool, thanks for both your input. šŸ˜