Fork me on GitHub
#cider
<
2023-10-05
>
dawdler13:10:38

Struggling a bit with deps.edn and cider. Have not had any problems with it earlier. Any reason why extra deps

…
:aliases 
  {:dev 
    {:extra-paths ["dev"]
     :extra-deps {integrant/repl {:mvn/version "0.3.3"}}}
…
gives java.io.FileNotFoundException could not locate ..., and is therefore not available on classpath from ROOT/dev/user.clj? (Using Emacs+Cider, starting REPL with -A:dev). It used to work so smoothly, iirc — it’s been a while. Output from clj -X:deps list :aliases '[:dev]':
$ clj -X:deps list :aliases '[:dev]'
...
integrant/integrant 0.8.1  (MIT)
integrant/repl 0.3.3  (MIT)
...
What am I missing?

Alex Miller (Clojure team)13:10:52

what's the actual error you're seeing? could not locate ... what?

dawdler13:10:31

2. Unhandled clojure.lang.Compiler$CompilerException
...
1. Caused by java.io.FileNotFoundException                                                                                                                                                                                     
   Could not locate integrant/repl__init.class, integrant/repl.clj or                                                                                                                                                          
   integrant/repl.cljc on classpath.                       

dawdler13:10:29

Starting cider with C-u C-c M-j adding -A:dev

jpmonettas13:10:16

can you paste the clojure command that cider is running? it will show it when it starts the repl

dawdler13:10:16

CIDER 1.8.0-snapshot

dawdler13:10:16

/opt/homebrew/bin/clojure -Sdeps \{\:deps\ \{nrepl/nrepl\ \{\:mvn/version\ \"1.0.0\"\}\ cider/cider-nrepl\ \{\:mvn/version\ \"0.38.1\"\}\ refactor-nrepl/refactor-nrepl\ \{\:mvn/version\ \"3.9.0\"\}\}\      
\:aliases\ \{\:cider/nrepl\ \{\:main-opts\ \[\"-m\"\ \"nrepl.cmdline\"\ \"--middleware\"\ \"\[refactor-nrepl.middleware/wrap-refactor\,cider.nrepl/cider-middleware\]\"\]\}\}\} -M:cider/nrepl  -A:dev

dawdler13:10:29

Oops, that's ugly

Alex Miller (Clojure team)13:10:53

that -A:dev has to be before the -M to take effect

jpmonettas13:10:20

yeah that is weird, mine puts all the aliases in -M

Alex Miller (Clojure team)13:10:26

-M (and -X and -T) consume all args after them

Alex Miller (Clojure team)13:10:46

combining into -M would be better :)

dawdler13:10:47

Ohh... is that new? Or have I somehow, for unknown reasons, just imagined it working before. Testing...

Alex Miller (Clojure team)13:10:59

not new, has been like that for al ong time

magnars13:10:04

Setting cider-clojure-cli-aliases to -A:dev should insert the alias correctly.

dawdler13:10:44

Okay, thanks a lot, folks. This will bring me on my merry way. 👍

jpmonettas13:10:23

yeah, I normally have a .dir-locals.el on each project with at least :

((clojure-mode . ((cider-clojure-cli-aliases . "dev:dev-tools:storm"))))

🙏 1
jpmonettas13:10:45

that will allow different aliases for different projects, now if you want to try that remember that this vars are set when you open a buffer, so you will have to re-open the buffers after creating that .dir-locals.el (just the first time)

dawdler13:10:14

Many thanks

vemv13:10:43

Aliases should start with a colon btw (not critical, and cider fixes it if missing) In Alex' words: > aliases should always use : > in some cases, aliases without colons are tolerated (but don't do that)

🙂 1
vemv13:10:35

btw your problem is a usual one for tools.dps - not the best UX from CIDER's side. Today I put an improvement in the hammock: https://github.com/clojure-emacs/cider/issues/3497#issuecomment-1748510919

dawdler13:10:10

To be fair, there is a warning about using -M and not -A. That's on me. But the issue comment looks like it could bring some improvement to the UX, indeed.

🙌 1
practicalli-johnny16:10:35

https://practical.li/spacemacs/clojure-development/project-configuration/ has examples of using .dir-locals.el with Clojure CLI aliases and other variables, also covers the basic syntax. In Emacs, the universal argument, i.e. C-u can be used before calling jack-in to check the command that will be used to jack-in (and edit it if required)

🙏 1
vemv19:10:21

ℹ️ cider-nrepl 0.39.0, as bundled with CIDER latest (Git master / snapshot) bundles refinements in the https://docs.cider.mx/cider/indent_spec.html#indentation-inference feature, such that it will work better with def-like and threading macros. It also powers something else which will be demoed tomorrow 👀

loading 8
👀 2