pom should respect optional dependencies
mainej opened this issue · 1 comments
My library has an optional dependency, that is, a dependency that is only needed when users need a specific part of the library. (Note that this is different from a "scope provided" dependency, which is always needed. Here is one explanation of the difference.) I would like to mark this dependency appropriately in my pom.xml, so that it isn't transitively included in my users' dependency trees unless they need it.
As of tools.deps.alpha
0.9.745 there is a way to specify this type of dependency. You add the dependency as a regular entry in :deps
, with an additional :optional true
flag. Then, when you run clojure -Spom
, the dependency is marked as <optional>true</optional>
in the pom. However, deps-library
depends on garamond
0.4.0, which in turn depends on tools.deps.alpha
0.5.460. Therefore deps-library
doesn't add the optional
tag, and in fact strips it out if it already exists.
So, I'd like to request that you coordinate with garamond
to update to a more recent version of tools.deps.alpha
. It looks like a bump of tools.deps.alpha
has already been committed, but that commit hasn't been released. I'll reach out to garamond
as well to request that they release a new version of their library.
Thanks for your work making deps.edn libraries work with Clojars—it's a really fiddly business.
As a bit more context, cljdocs wasn't able to build my library because my pom.xml didn't include the optional dependency. After adding the optional dependency, cljdocs builds OK. However, to get the optional dependency into the pom, I have to shell out to clojure -Spom
in the middle of my deploy process. I'd rather be able to use the regular clojure -A:release --patch
flow.