This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-23
Channels
- # adventofcode (135)
- # announcements (9)
- # babashka (27)
- # beginners (97)
- # bristol-clojurians (8)
- # calva (7)
- # chlorine-clover (1)
- # cider (3)
- # clara (16)
- # clj-kondo (9)
- # cljdoc (137)
- # clojars (4)
- # clojure (110)
- # clojure-europe (118)
- # clojure-taiwan (8)
- # clojure-uk (19)
- # clojurescript (30)
- # conjure (6)
- # cryogen (32)
- # datomic (11)
- # depstar (1)
- # duct (4)
- # emacs (6)
- # fulcro (73)
- # graalvm (9)
- # keechma (7)
- # leiningen (16)
- # luminus (1)
- # malli (35)
- # meander (3)
- # off-topic (45)
- # pathom (1)
- # pedestal (2)
- # re-frame (3)
- # reagent (31)
- # reitit (2)
- # reveal (17)
- # shadow-cljs (34)
- # tools-deps (11)
- # xtdb (14)
thanks, I'll see what I can do then. My goal, as I said is to be able to use my version of clj-antl (with patches) from git. deps.edn seemed like a good fit until I got to the java classes for which I don't have a solutin. I do have a direction now. Let's see where it leads.
Hi all, I'm learning about clj
and deps.edn
, and I had come up with an alias to connect to an nrepl server:
:dev {;; some dev deps }
:repl/connect {:extra-paths ["env/dev" "resources/dev]
:extra-deps {nrepl/nrepl {:mvn/version "0.8.3"}}
:main-opts ["-m" "nrepl.cmdline" "--connect"]}}}
This allowed me to run
clj -M:dev:repl/connect --host $HOST --port $PORT
Then I was reading about .clojure/deps.edn
and figured I could move that repl/connect
alias out, and I ended up with these snippets:
;; .clojure/deps.edn
:repl/connect {:extra-deps {nrepl/nrepl {:mvn/version "0.8.3"}}
:main-opts ["-m" "nrepl.cmdline" "--connect"]}}}
;; repository
:repl/connect {:extra-paths ["env/dev" "resources/dev"]}
I thought this would basically merge
these into the first form, but not when I run
clj -M:dev:repl/connect --host $HOST --port $PORT
I see
Exception in thread "main" java.io.FileNotFoundException: --host (No such file or directory)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
at clojure.lang.Compiler.loadFile(Compiler.java:7570)
at clojure.main$load_script.invokeStatic(main.clj:452)
at clojure.main$script_opt.invokeStatic(main.clj:512)
at clojure.main$script_opt.invoke(main.clj:507)
at clojure.main$main.invokeStatic(main.clj:598)
at clojure.main$main.doInvoke(main.clj:561)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.main.main(main.java:37)
It seems like I'm missing something but I don't know what. I'd like a generic repl/connect
that I can use across projects and pass --host
and --port
toIf I understand correctly, merge
takes the last value of the key. So, since you are using the same key in your ~/.clojure/deps.edn
and in your ${REPODIR}/deps.edn
the one in the repo is "winning" and overriding the other one. It is probably best to use two different aliases and add them to the -M:
command line option.
@seancorfield’s response in the main thread is more accurate than mine.
Aliases overwrite each other in the system -> user -> project -> command-line order (so last one wins).
The merge happens on the :aliases
key, not on the nested aliases themselves.
So, in your case, :repl/connect
in your project overwrites your user-level version and thus the --host
argument is passed to Clojure's main, because the nREPL stuff isn't present in the merged EDN.
If you have multiple non-conflicting aliases, the bodies of the aliases are merged, but with :main-opts
the last one wins (those are not merged). /cc @dorab
It also looks like your repository’s :repl/connect
alias’ :extra-paths
may be more suited to be in :dev
?
@seancorfield oh I see, I thought the merging happened on the aliases themselves. Thanks!