cider-jack-in works inside or outside Boot projects. That is, in a directory with build.boot or outside such a directory but with cider-default-repl-command set to "boot".
On Linux this works on recent versions of Cider. On Windows it fails with the following trace.
Are you sure you want to run `cider-jack-in' without a Clojure project? (y or n) y
[nREPL] Starting server via "c:/Users/jmacdonald/local/boot/boot.exe" -i "(require 'cider.tasks)" -d "org.clojure/tools.nrepl:0.2.13" -d "cider/cider-nrepl:0.18.0" cider.tasks/add-middleware -m "cider.nrepl/cider-middleware" cider.tasks/nrepl-server -b :: wait...
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: Classpath conflict: org.clojure/clojure version 1.10.0-alpha7 already loaded, NOT loading version 1.2.0
java.lang.Thread.run
java.util.concurrent.ThreadPoolExecutor$Worker.run
java.util.concurrent.ThreadPoolExecutor.runWorker
java.util.concurrent.FutureTask.run
...
clojure.core/binding-conveyor-fn/fn core.clj: 2022
boot.core/boot/fn core.clj: 1032
boot.core/run-tasks core.clj: 1022
cider.tasks/eval224/fn/fn/fn tasks.clj: 33
...
cider-nrepl.main/start-nrepl main.clj: 54
cider-nrepl.main/build-handler main.clj: 33
cider-nrepl.main/->mw-list main.clj: 29
clojure.core/into core.clj: 6844
clojure.core/transduce core.clj: 6829
clojure.core.protocols/fn/G protocols.clj: 13
clojure.core.protocols/fn protocols.clj: 75
clojure.core.protocols/seq-reduce protocols.clj: 31
clojure.core.protocols/fn/G protocols.clj: 19
clojure.core.protocols/fn protocols.clj: 136
...
clojure.core/map/fn/fn core.clj: 2734
clojure.core/symbol core.clj: 579
java.lang.ClassCastException: boot.repl$disable_exception_colors cannot be cast to java.lang.String
clojure.lang.ExceptionInfo: boot.repl$disable_exception_colors cannot be cast to java.lang.String
line: 5
error in process sentinel: Could not start nREPL server: Classpath conflict: org.clojure/clojure version 1.10.0-alpha7 already loaded, NOT loading version 1.2.0
java.lang.Thread.run
java.util.concurrent.ThreadPoolExecutor$Worker.run
java.util.concurrent.ThreadPoolExecutor.runWorker
java.util.concurrent.FutureTask.run
...
clojure.core/binding-conveyor-fn/fn core.clj: 2022
boot.core/boot/fn core.clj: 1032
boot.core/run-tasks core.clj: 1022
cider.tasks/eval224/fn/fn/fn tasks.clj: 33
...
cider-nrepl.main/start-nrepl main.clj: 54
cider-nrepl.main/build-handler main.clj: 33
cider-nrepl.main/->mw-list main.clj: 29
clojure.core/into core.clj: 6844
clojure.core/transduce core.clj: 6829
clojure.core.protocols/fn/G protocols.clj: 13
clojure.core.protocols/fn protocols.clj: 75
clojure.core.protocols/seq-reduce protocols.clj: 31
clojure.core.protocols/fn/G protocols.clj: 19
clojure.core.protocols/fn protocols.clj: 136
...
clojure.core/map/fn/fn core.clj: 2734
clojure.core/symbol core.clj: 579
java.lang.ClassCastException: boot.repl$disable_exception_colors cannot be cast to java.lang.String
clojure.lang.ExceptionInfo: boot.repl$disable_exception_colors cannot be cast to java.lang.String
line: 5
(setf cider-default-repl-command "boot")
M-x cider-jack-in
REPL won't launch, but I'm using a version tagged 20180903.1611. It corresponds to commit 8996e699ae7dd140a9f74219940e2e30ff213fd9
~/.boot/boot.properties as below. (The same errors occur with other versions of Boot and Clojure.)
#http://boot-clj.com
#Thu Sep 06 09:04:38 CDT 2018
BOOT_CLOJURE_NAME=org.clojure/clojure
BOOT_VERSION=2.8.1
BOOT_CLOJURE_VERSION=1.10.0-alpha7
GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-29
From the emax64 project.
Windows 7.
Is there a way for you to see where is this dependency on Clojure 1.2 coming from? Might be from the default injection of nREPl 0.2.13, which I should probably remove now that nREPL 0.4 is here.
The 1.2 dependency is from nREPL. At least, those errors disappear when removing the dependency from the Boot invocation (boot -i "(require 'cider.tasks)" -d cider/cider-nrepl\:0.18.0 cider.tasks/add-middleware -m cider.nrepl/cider-middleware cider.tasks/nrepl-server -b :: wait). Note that the Boot REPL task includes its own dependency on nREPL but excludes Clojure.
Errors remain, however. I believe the classpath conflict is a red herring. After a little investigation, I can duplicate the error outside of Windows with boot -C -i "(require 'cider.tasks)" -d cider/cider-nrepl\:0.18.0 cider.tasks/add-middleware -m cider.nrepl/cider-middleware cider.tasks/nrepl-server -b :: wait. This eliminates the classpath conflict but also disables colored output explicitly with -C.
->mw-list seems to be trying to convert disable-exception-colors into a string but for the life of me I can't figure out why.
What's disable-exception-colors?
@arichiardi Any insight here, as someone familiar with boot?
It's middleware that disables colorization, defined here. It can be triggered on Linux with the -C flag. That's as much as I know, will let others elaborate.
I see. Might be something wrong in the nrepl-server task in cider-nrepl then. @arichiardi will definitely know more. I'm guessing you won't be having this problem if you update to Boot 2.8.2 and simply change back cider-jack-in to use its server task (as 2.8.2 bundles nREPL 0.4 directly).
Uhm i hace no clue, boot was definitely working ootb. Will try to dig more these days, thanks for debugging the problem!
Which server task are you referring to? Installed 2.8.2 but the command from above (with -C) still fails for me. It's a minor inconvenience as the REPL still starts and I can connect to it.
See cider-boot-parameters and change its value to "server -b :: wait". Your stacktrace implies that the bug is in the nrepl-server boot task, so I assume that if you sidestep it things will work for you.
I'm getting no such task with those parameters.
Ops, my bad. It's repl -b :: wait.
Yep, that works. On 2.8.1 as well.
True, but then you'll end up using the legacy nREPL, which I would not recommend at this point. Anyways, we've confirmed for a fact that there's a bug in the custom nrepl-server task. Hopefully @arichiardi will sort this out quickly.
Eh, the only hint I can give without inspecting more is that that particular middleware is ^:private.
My spider senses tell me that that my be the reason. Hopefully I will have time soon for another look.
As a workaround, you could add
BOOT_COLOR=1 to your ~/.boot/boot.properties file
cider-jack-in works for me after doing that
I think I've figured this one out:
BOOT_COLOR env var to something other than 1, true, or yes (see https://github.com/boot-clj/boot/blob/master/boot/pod/src/boot/util.clj#L45) then boot adds the middleware boot.repl/disable-exception-colors to boot.repl/*default-middleware* . It adds the function itself - not a symbol, var, string, or something else representing the middlewarecider.tasks/nrepl-server passes the value of boot.repl/*default-middleware* to cider.nrepl/start-nreplcider.nrepl/start-nrepl expects vars or strings, not functionsThis issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!
@flyingmachine Great analysis!
Not sure where exactly we should fix this, but keep in mind that we're no longer using cider.nrepl/start-nrepl (this was push to nREPL itself). The old ns in cider-nrepl should be removed.
Now the question remains where exactly should this be fixed - on boot's side or on nREPL side? I don't really have a strong preference, but changing this on Boot's end seems more reasonable to me.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!
This issues been automatically closed due to lack of activity. Feel free to re-open it if you ever come back to it.
Most helpful comment
As a workaround, you could add
BOOT_COLOR=1to your~/.boot/boot.propertiesfilecider-jack-inworks for me after doing that