This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-29
Channels
- # admin-announcements (1)
- # announcements (20)
- # babashka (43)
- # beginners (134)
- # calva (2)
- # clerk (7)
- # cljdoc (9)
- # clojars (8)
- # clojure (91)
- # clojure-europe (21)
- # clojure-nl (1)
- # clojure-norway (13)
- # clojure-uk (1)
- # clojurescript (5)
- # datahike (3)
- # docker (2)
- # emacs (6)
- # fulcro (7)
- # graphql (9)
- # honeysql (24)
- # improve-getting-started (5)
- # introduce-yourself (1)
- # lambdaisland (1)
- # luminus (3)
- # malli (3)
- # nbb (19)
- # off-topic (22)
- # pathom (1)
- # portal (3)
- # practicalli (1)
- # rdf (26)
- # reagent (29)
- # reitit (9)
- # shadow-cljs (15)
- # spacemacs (3)
- # sql (4)
- # tools-build (30)
- # xtdb (41)
I have a case with multiple "modules" in a repo, each with its own deps.edn, pointing to each other via deps local/root "../foo/" (so there can be multiple levels of deps of that kind, foo can depend on another module the same way), so far so good. It works for most things, until I try to build a jar (with some fairly common b/write-pom b/copy-dir etc b/jar. That jar loose any traces of the local/root deps sources (they are in basis but not included in the jar in any form). Maybe it's expected, maybe not, not sure. I could imagine the src of these would be included and their deps expanded to look for other local/root mentions.
I suppose one could do that work at jar creation time but since it works transparently for git deps I could imagine it should also for local/root deps
Can you be more specific about what “doesn’t work”?
this leads to workarounds such as https://github.com/seancorfield/build-clj/blob/main/src/org/corfield/build.clj#L185-L189
That seems normal - usually you only have your own sources in a jar you make unless it’s an uberjar
if you build a jar from local/root deps you'd expect them to be "included" as they will bever be resolved
Well, your expectations may vary from mine :)
But, as Sean has done apparently, you have the tools to identify the paths for local deps from the basis and the means to copy their sources into a jar making location
yes we do something like that currently, but I suppose that could be built'in (via an option to local/root maybe)
Feel free to file a request on ask Clojure, but it is not going to be at the top of my list for a while
clojure-site is available for issues and prs…
you said at the top that this "transparently works for git deps" but I don't think that's true. it should work (for both) in uber
FWIW, depstar
used to rely on (:classpath-roots basis)
to find directories to copy into the uberjar.
No, as I said earlier, we use AOT and rely on transitive compilation to pull code into our uberjars. We do not build library JARs at work.
Oh ok. That’d be the ideal solution (not building lib jars), unfortunately not all consumers of our internal libs are on t.deps yet
it seems @seancorfield hit that one in the past, I might just take the same approach/workaround
Since compile is transitive, we rely on that to compile all the :local/root
stuff into the project's classes dir, to be bundled up into the uberjar: we don't bother with source in the uberjar -- and we don't have any dynamic loading at runtime (of our own code, at least).
Ah, yeah, libs built with source deps are problematic because you want some source deps but not all source deps. As noted in the other thread, depstar
used (:classpath-roots basis)
to find source to copy in -- and only later added a :paths-only
option to avoid copying in source deps for thin JAR files. It's deprecated/archived now but you can go look at the source to see what it did...