Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pom should respect optional dependencies #14

Open
mainej opened this issue Jul 16, 2021 · 1 comment
Open

pom should respect optional dependencies #14

mainej opened this issue Jul 16, 2021 · 1 comment

Comments

@mainej
Copy link

mainej commented Jul 16, 2021

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.

@mainej
Copy link
Author

mainej commented Jul 16, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant