Welcome! Please see the About page for a little more info on how this works.

+6 votes
in tools.deps.alpha by

When adding a dependency, I'd like to be able to specify aliases in coordinates of libraries that use deps.edn, for example:

{:deps {org.clojure/clojure {:mvn/version "1.10.0"}
        org.openjfx/javafx-base {:mvn/version "12-ea+10"}}
 :aliases {:web {:extra-deps {org.openjfx/javafx-web {:mvn/version "12-ea+10"}}
                 :extra-paths ["src/web"]}
           :controls {:extra-deps {org.openjfx/javafx-controls {:mvn/version "12-ea+10"}}
                      :extra-paths ["src/controls"]}}
 :paths ["src/base"]}


{:deps {git/lib {:git/url "..." 
                 :sha "..."
                 :aliases ["controls"]}}}

This way it will be possible to make more fine-grained libraries that may have optional code/dependencies which won't bloat classpath when unneeded.

3 Answers

0 votes

Comment made by: borkdude

Interestingly, I think this also implements a feature that some people have been asking for, namely managed dependencies.

libs/deps.edn could be an empty project that only describes groups of dependencies via aliases (managed deps).
app/deps.edn can consume these groups like in the above example.

Minor detail: maybe :aliases should contain keywords instead of strings?

0 votes
Reference: https://clojure.atlassian.net/browse/TDEPS-116 (reported by alex+import)
0 votes

Yes please! Being able to use an alias, or aliases, in a git dependency offers the opportunity to stitch together different facets of a single project. A single project may contain aliases for different architectural levels such as a core library, or a server implementation etc. Clients of that project could then choose to use those different facets as required. The current alternative is to use multiple git repositories.