Fork me on GitHub
#cider
<
2021-12-03
>
diego.videco20:12:09

Hello I am having trouble jacking in to a polylith project (not sure if it is due to it, I am new to the project). The trouble is actually that no dependencies are being loaded so getting things like: Could not locate io/pedestal/http__init.class, io/pedestal/http.clj . The jack-in startup string is this:

/usr/local/bin/clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version "0.9.0-beta5"} refactor-nrepl/refactor-nrepl {:mvn/version "3.1.0"} cider/cider-nrepl {:mvn/version "0.27.2"}} :aliases {:cider/nrepl {:main-opts ["-m" "nrepl.cmdline" "--middleware" "[refactor-nrepl.middleware/wrap-refactor,cider.nrepl/cider-middleware]"]}}}' -M:cider/nrepl -A:dev:test
If I try to connect by launching a command line process with this string, then everything works fine:
clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"0.8.3"},cider/cider-nrepl {:mvn/version,"0.27.2"}}}' -A:dev:test -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
Can anyone help me figure out what is going on?

dpsutton20:12:22

i don’t think this can work: -M:cider/nrepl -A:dev:test. If you use a prefix arg with jack in you can edit the string. If you instead edit it to be -M:dev:test:cider/nrepl does it work?

Alex Miller (Clojure team)21:12:26

Would work if you swapped the order -M and -X consume all arguments after them so -A should go prior to be used

Alex Miller (Clojure team)21:12:41

But putting them all with -M is better

dpsutton21:12:07

ah that’s right. I think i used to prefer the “aliases” and then “main” style but it doesn’t really matter. and it gets confusing because -A still allows for main args from an alias so it doesn’t do what i thought it was doing anyways

dpsutton20:12:32

once that is confirmed, i think you can set

(defcustom cider-clojure-cli-aliases
  nil
  "A list of aliases to include when using the clojure cli.
Should be of the form `foo:bar`.  Any leading \"-A\" or \"-M\" will be
stripped as these are concatenated into the \"-M[your-deps]:cider/nrepl\"
form."
  :type 'string
  :group 'cider
  :safe #'stringp
  :package-version '(cider . "1.1"))
to include those and it will work it out

diego.videco20:12:51

Thanks, this works indeed (pretty new to tools.deps as well)

dpsutton20:12:49

so in a dir locals you’d include (cider-clojure-cli-aliases . "dev:test")

diego.videco20:12:05

So then I can do cider-jack-in-clj? I am trying that without luck. I have the .dir-locals.el in the same directory as my deps.edn (never used .dir-locals.el so I am not sure if I am doing something wrong)

diego.videco20:12:08

I see this error though: Error reading dir-locals: (wrong-type-argument listp "dev:test")

dpsutton20:12:39

yeah that is just a snippet of the dir local

dpsutton20:12:14

i think

((nil
  (cider-clojure-cli-aliases . "dev:drivers:drivers-dev:ee:ee-dev:user")))
is a full one you can use

dpsutton20:12:41

it’s an alist of modes to overrides. use nil to say “all modes”, and the override is the cli alias is “dev:test”

dpsutton20:12:50

(i used our aliases here so substitute your own)

dpsutton20:12:29

then you just cider-jack-in-clj. That’s the point of the dir-locals, in directories, these variables will be set.

dpsutton22:12:24

my pleasure. glad you have it working