Fork me on GitHub

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" --host (No such file or directory)
        at java.base/ Method)
        at java.base/
        at java.base/<init>(
        at java.base/<init>(
        at clojure.lang.Compiler.loadFile(
        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(
        at clojure.lang.Var.applyTo(
        at clojure.main.main(
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 to


If 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.

đź‘Ť 3

@seancorfield’s response in the main thread is more accurate than mine.


thank you, I thought it merged the aliases themselves


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!