nrepl

Drew Verlee 2022-12-08T18:02:34.203529Z

So when clj -A:cider-clj with the following deps alias:

:cider-clj {:extra-deps {cider/cider-nrepl {:mvn/version "0.22.4"}}
              :main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]}
This starts an nrepl server. Now, assuming i want to launch an HTTP server. I know i could use my editor to connect to the nrepl, then send nrepl the expression to launch the HTTP server. But is there another way where that happens through the command line invocation? maybe by adding another alias? Something like clj -M:cider-clj:start-server where start-server points to a exec-fn key in deps that points the start server function? I tried that it and it doesn't seem to work, i assume because you can't have both a main-opts and a exec-fn. MY other thought is that i have to extend the main-opts functionality, that is, pass something to the nrepl cmdline.

dpsutton 2022-12-08T18:04:07.378639Z

you can only have one entry point. So the pre-defined ones start an nrepl server, or start a web-server, but neither does both. you could make your own entry point that starts a webserver and also starts an nrepl server though

Drew Verlee 2022-12-08T18:05:10.049609Z

gotcha.

Drew Verlee 2022-12-08T18:34:08.494389Z

How do i resolve this warning:

WARNING: clj-refactor and refactor-nrepl are out of sync.
Their versions are 3.6.0 (package: 20221023.1644) and n/a, respectively.
You can mute this warning by changing cljr-suppress-middleware-warnings.
given i got it while running cider-connect-clj then picking an nrepl port of the server started by running: clj -M:dev:refactor:cider-clj Where the aliases are defined as such:
:cider-clj {:extra-deps {cider/cider-nrepl {:mvn/version "LATEST"}}
                       :main-opts  ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]}

           :refactor {:extra-deps {refactor-nrepl {:mvn/version "LATEST"}
                                   cider/cider-nrepl {:mvn/version "LATEST"}}}

;; note dev isn't likely relevant here...
           :dev {:extra-paths ["dev"]
                 :extra-deps {expound/expound {:mvn/version "0.9.0"}
                              reloaded.repl/reloaded.repl {:mvn/version "0.2.4"}
                              org.clojure/tools.namespace {:mvn/version "1.3.0"}}}
i wouldn't have expected this error because it's saying the emacs https://practical.li/spacemacs/refactor/clj-refactor/ package is installed, but the refactor-nrepl clojure middleware dep isn't, which it should be, in my mind, because i include it through the extra deps in the "refactor" alias

dpsutton 2022-12-08T18:35:12.916139Z

are you sure the middleware was added to the nrepl server?

dpsutton 2022-12-08T18:35:19.028469Z

>

"-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"
>

dpsutton 2022-12-08T18:35:29.570999Z

its not added to the nrepl server. it is just on the classpath

dpsutton 2022-12-08T18:35:47.523719Z

just jack-in like normal and copy the startup command and use parts of that

dpsutton 2022-12-08T18:36:12.504119Z

also don’t use LATEST because it has to hit maven each day to get the latest LATEST. Just go with the numbers from the regular jack-in command

dpsutton 2022-12-08T18:36:22.189269Z

its printed at the top of the repl buffer

Drew Verlee 2022-12-08T18:59:16.390189Z

thanks a lot. i think i get it now. πŸ™‚

πŸ‘ 1