Fork me on GitHub
Ben Sless07:07:44

Hello ciderians, I'm trying to start a headless repl with docker run and cider-connect to it. Getting the following error message:

[nREPL] Establishing direct connection to localhost:9999 ...
[nREPL] Direct connection to localhost:9999 established
[nREPL] Connection closed unexpectedly (connection broken by remote peer)
nrepl-send-sync-request: Sync nREPL request timed out (op clone id 1)
This is how I ran it:
docker run \
       -p 9999:9999 \
       -e "TOKEN=$TOKEN" \
       --rm \
       -v "$PWD":/usr/src/app \
       -w /usr/src/app clojure:openjdk-14-lein-2.9.3 \
       lein \
       update-in :dependencies conj \[nrepl\ \"0.8.0-alpha5\"\] -- \
       update-in :plugins conj \[refactor-nrepl\ \"2.5.0\"\] -- \
       update-in :plugins conj \[cider/cider-nrepl\ \"0.25.3-SNAPSHOT\"\] -- \
       repl :headless :host localhost :port 9999
Is there another port I need to bind?

Ben Sless07:07:39

trivially solved with --net=host instead of port mapping. huh.

Ian Fernandez13:07:17

mine .dir-locals.el is

Ian Fernandez13:07:20

((clojure-mode (cider-jack-in-default . "clojure-cli") (cider-clojure-cli-global-options . "-A:test") (clojure-align-forms-automatically . nil)))

Ian Fernandez13:07:37

jack-in-default is not giving me directly clojure-cli

Ian Fernandez13:07:53

it opens the menu asking if its lein or clojure-cli


What’s the docstring for “cider-jack-in-default”?

Ian Fernandez13:07:06

cider-jack-in-default is a variable defined in ‘cider.el’.
Its value is ‘clojure-cli’

  This variable has an alias: ‘cider-default-repl-command’.
  This variable is safe as a file local variable if its value
  satisfies the predicate ‘symbolp’.
  You can customize this variable.
  This variable was introduced, or its default value was changed, in
  version 0.9.0 of the cider package.

The default tool to use when doing ‘cider-jack-in’ outside a project.
This value will only be consulted when no identifying file types, i.e.
project.clj for leiningen or build.boot for boot, could be found.

As the Clojure CLI is bundled with Clojure itself, it’s the default.
In the absence of the Clojure CLI (e.g. on Windows), we fallback
to Leiningen.

Ian Fernandez13:07:25

but I want this on this project


That says “the value will only be consulted when no identifying file types “ are found


You want the preferred build tool version

Ian Fernandez13:07:14

anyone here knows about a variable I can change to have a default jack-in command?


@d.ian.b See cider-preferred-build-tool.

clj 3

How do I change cljs compiler option when jack-in with cider? I use clojure cli against nodejs. My guess is to start from the form (cider.piggieback/cljs-repl (cljs.repl.node/repl-env))


ah, it's the parameters to cljs-repl after the first. I tried a hash-map instead of flattened keys, therefore I got errors


When i execute C-u C-c M-j i am able to write and run some alias from my deps.edn. but cider dont execute this alias if i dont remove all the line:

/usr/local/bin/clojure -Sdeps ... -m nrepl.cmdline --middleware '["refactor-nrepl.middleware/wrap-refactor", "cider.nrepl/cider-middleware"]'


i'm not sure i follow


@papachan does your alias contain :main-opts?


right now i disable all. i have this:


just left :extra-paths with a dev directory to check it run clj file there


when i call from command line clj -A:dev it run perfect and show a result after being compiled.


OK seems the alias run as expected because i see the files from my dev/ directory. But the difference from calling from command line, it dont compile the files from this directory. i have to do it manually.


:main-opts do not run with Jack in


ah ok. good to know. is there a way to see which config is loaded with cider repl? to check the directory list, classes etc


the repl will startup and show its startup command