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

0 votes
in tools.deps by

Running the following at the command line:

clj -Acider -m "nrepl.cmdline" "--middleware" "[refactor-nrepl.middleware/wrap-refactor cider.nrepl/cider-middleware]"

Given:

:cider {:extra-deps {nrepl {:mvn/version "0.6.0"}
                                refactor-nrepl {:mvn/version "2.5.0-SNAPSHOT"}
                                cider/cider-nrepl {:mvn/version "0.23.0-SNAPSHOT"}}}

Works. But moving it to a :main-opts:

:cider {:extra-deps {nrepl {:mvn/version "0.6.0"}
                                refactor-nrepl {:mvn/version "2.5.0-SNAPSHOT"}
                                cider/cider-nrepl {:mvn/version "0.23.0-SNAPSHOT"}}
                   :main-opts ["-m" "nrepl.cmdline" "--middleware" "[refactor-nrepl.middleware/wrap-refactor cider.nrepl/cider-middleware]"]}

And running:

clj -Acider

Fails with:

Exception in thread "main" java.lang.RuntimeException: EOF while reading                                                         [5/723]
        at clojure.lang.Util.runtimeException(Util.java:221)                                                                            
        at clojure.lang.EdnReader.readDelimitedList(EdnReader.java:746)                                                                 
        at clojure.lang.EdnReader$VectorReader.invoke(EdnReader.java:672)                                                               
        at clojure.lang.EdnReader.read(EdnReader.java:145)                                                                              
        at clojure.lang.EdnReader.read(EdnReader.java:111)                                                                              
        at clojure.lang.EdnReader.readString(EdnReader.java:67)
        at clojure.edn$read_string.invokeStatic(edn.clj:46)
        at clojure.edn$read_string.invokeStatic(edn.clj:37)
        at clojure.edn$read_string.invoke(edn.clj:37)
        at nrepl.cmdline$parse_cli_values$fn__1275.invoke(cmdline.clj:248)
        at clojure.core$fn__8072$fn__8074.invoke(core.clj:6760)
        at clojure.core.protocols$iter_reduce.invokeStatic(protocols.clj:49)
        at clojure.core.protocols$fn__7839.invokeStatic(protocols.clj:75)
        at clojure.core.protocols$fn__7839.invoke(protocols.clj:75)
        at clojure.core.protocols$fn__7781$G__7776__7794.invoke(protocols.clj:13)
        at clojure.core$reduce.invokeStatic(core.clj:6748)
        at clojure.core$fn__8072.invokeStatic(core.clj:6750)
        at clojure.core$fn__8072.invoke(core.clj:6750)
        at clojure.core.protocols$fn__7860$G__7855__7869.invoke(protocols.clj:175)
        at clojure.core$reduce_kv.invokeStatic(core.clj:6776)
        at clojure.core$reduce_kv.invoke(core.clj:6767)
        at nrepl.cmdline$parse_cli_values.invokeStatic(cmdline.clj:246)
        at nrepl.cmdline$parse_cli_values.invoke(cmdline.clj:242)
        at nrepl.cmdline$args__GT_cli_options.invokeStatic(cmdline.clj:261)
        at nrepl.cmdline$args__GT_cli_options.invoke(cmdline.clj:253)
        at nrepl.cmdline$_main.invokeStatic(cmdline.clj:447)
        at nrepl.cmdline$_main.doInvoke(cmdline.clj:443)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.lang.Var.applyTo(Var.java:702)
        at clojure.core$apply.invokeStatic(core.clj:657)
        at clojure.main$main_opt.invokeStatic(main.clj:317)
        at clojure.main$main_opt.invoke(main.clj:313)
        at clojure.main$main.invokeStatic(main.clj:424)
        at clojure.main$main.doInvoke(main.clj:387)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.lang.Var.applyTo(Var.java:702)
        at clojure.main.main(main.java:37)

1 Answer

+2 votes
by
selected by
 
Best answer

I believe this is a known issue. The problem is the space between the middlewares. At the shell escaping is fine via "" but in the config file it is passed as a plain arg which then gets split into 2 since it is no longer escaped.

The common workarround for this is using a , instead of a space, since clojure treats it as a whitespace anyway.

:main-opts ["-m" "nrepl.cmdline" "--middleware" "[refactor-nrepl.middleware/wrap-refactor,cider.nrepl/cider-middleware]"]
...