Fork me on GitHub
#leiningen
<
2016-08-25
>
timgilbert18:08:08

Say, if I'm writing a library and it has some optional functionality that can be used with the mount library, but mount isn't required in order to use it, would I put something like this in the project's dependencies?

[mount "0.1.10" :scope "provided"]

darwin18:08:21

I think “provided" is just telling lein to prefer user’s version, not your library’s version of the dep

darwin18:08:36

I’m afraid, to really depend on a library optionally you will have to require it dynamically triggered by some usage scenario

hypirion20:08:53

@timgilbert: See https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md#default-profiles – Especially the section that starts with "The :provided profile is used to specify dependencies that should be available during jar creation, but not propagated to other code that depends on your project...."

hypirion20:08:32

TL;DR:

:profiles {:provided {:dependencies [[mount "0.1.10"]]}}
Is the recommended approach

timgilbert20:08:01

Oh, great, that makes sense. Thanks @hypirion!