This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-18
Channels
- # aleph (1)
- # announcements (31)
- # babashka (9)
- # babashka-sci-dev (36)
- # beginners (72)
- # calva (20)
- # clj-kondo (99)
- # cljsrn (1)
- # clojure (77)
- # clojure-europe (33)
- # clojure-nl (4)
- # clojure-norway (12)
- # clojure-uk (4)
- # clojurescript (23)
- # cursive (2)
- # datascript (5)
- # events (1)
- # fulcro (3)
- # honeysql (3)
- # inf-clojure (82)
- # interop (2)
- # kaocha (10)
- # lsp (15)
- # meander (1)
- # missionary (10)
- # off-topic (22)
- # pathom (4)
- # pedestal (3)
- # polylith (20)
- # re-frame (10)
- # react (4)
- # reagent (4)
- # reitit (27)
- # ring-swagger (1)
- # shadow-cljs (34)
- # specter (3)
- # sql (1)
- # testing (5)
- # tools-deps (22)
- # vim (12)
https://github.com/polyfy/polylith/blob/5292e8ab1bea3ff84b08c7f2142dbe7f1349a3f3/deps.edn#L78-L81 that uses the keys :deps
and :paths
in one of its aliases as opposed to their (extra/replace) counterparts. I failed to find any documentation wrt the usage of these keys in an alias. Does anyone know where I could get more info on why someone would want to use them there as opposed to :extra-*
?
They are synonyms for :replace-deps and :replace-paths - notably they replace the project paths and deps rather than add to
@U08BJGV6E see https://clojure.org/guides/tools.build for examples where you have :deps
in aliases.
Thank you both, I see I was looking in the wrong place.
However, I do have a question wrt synonyms @U064X3EF3 - I don't see the phrases replace
or synonym
at https://clojure.org/guides/tools_build - so my question is, are these synonyms (as in all contexts) or only appear to behave like synonyms due how https://clojure.org/reference/deps_and_cli#_aliased_tool_execution works?
What is the intended behavior of these keys when the alias in question is used not in a tool execution context but to start a repl together with other aliases, like clj -A:build:dev:test
?
They are synonyms in all alias contexts
No difference in tool / non-tool
Well I guess the big difference is that -T removes the project paths and deps regardless
Oh I see, thank you.
So is my understanding correct that if I want to use an alias both as a tool with only the deps/paths specified in the alias: clojure -T:my-alias
and as an additional alias (with the additonal paths/deps) for a repl: clojure -A:dev:test:my-alias
then I should just continue using :extra-paths/deps
?
And a side question just so I understand properly: if deps/replace-deps
and paths/extra-paths
are synonyms in every context, then why do both exist? Is using one recommended over using the other in some contexts and why?
Historical reasons and, now, backward compatibility.
I'm afk right now (on vacation in England) but I thought deps/paths behaved in a context-sensitive manner. If have to double check the source 😁
I guess I should be able to throw something together next week to test my assumptions in case there isn't some official-like documentation that explains this. Enjoy your holiday!
I found the synonyms confusing myself. I prefer using the specific keys so it's very clear what the alias does
Ended up with a small demo https://github.com/imrekoszo/try-deps-tool-replace
in the context of running a tool with -T, the project :deps and :paths are removed, so it may feel more natural in that case to use :deps and :paths rather than :replace-deps and :replace-paths. But in the context of -X where :deps and :paths are not removed, it can be helpful to use :replace-deps and :replace-paths to make that clear. so, that's why both synonyms exist
Thank you Alex. Is my understanding correct that there in the -T:tool context one could also use :extra-*
without any observable difference at runtime (due to the removal you mentioned)?
If the answer to that is yes, then would it be safe to assume that if an alias is to be used both as a -T
tool and an extra alias for my repl, it would be better to stick with :extra-*
if I don't want it to affect project deps/paths when in the repl?
When I follow this guide (the uberjar case) https://clojure.org/guides/tools_build, after writing the suggested content in build.clj
and deps.edn
, I get this interaction:
$ clj -X:build clean
Namespace could not be loaded: build
What am I doing wrong?