polylith

msolli 2024-12-12T11:04:19.181879Z

The migration of our code base into Polylith is coming along nicely. However, with Cursive, either I or Cursive or both are confused about which source files belong to which "module". In my mind, the idea is that in the dev REPL, I should be able to load any namespace in any component, base and project, and also to be able to run any test in any component, base, or project. Or am I mistaken? I have a dev project (the root deps.edn file) with all of the bricks included in the :dev profile :extra-deps (as :local/root deps). There is also a :test alias that lists the test paths for all bricks under :extra-paths. I run a JVM process with clj -M:dev:test:repl -m nrepl.cmdline , to which I connect from Cursive with a "Remote REPL" run configuration set to the "root" "Context module". But it seems I cannot load just any ns from my bricks into this REPL. The "Sends to REPL"-family of commands are disabled in most namespaces, but, confusingly, they are enabled for one of the components. So is this an instance of me having wrong expectations for how this should work, or might there be something wrong with my setup or with Cursive itself?

imre 2024-12-12T11:07:18.144679Z

I'm assuming you've set Cursive up according to https://cursive-ide.com/userguide/polylith.html

msolli 2024-12-12T11:07:29.068759Z

Yes

imre 2024-12-12T11:08:32.908889Z

and do you have dev and test ticked in your Clojure Deps tool window?

msolli 2024-12-12T11:08:43.455869Z

I don't use the clojure.test run configurations, though. I prefer running the tests in the REPL.

msolli 2024-12-12T11:08:46.604349Z

Yes

imre 2024-12-12T11:10:38.052599Z

And have you tried doing a "refresh clojure deps projects"?

msolli 2024-12-12T11:11:54.353449Z

Oh yes, several times! 🙂 And re-importing the root module (after removing all modules). And restarting IntelliJ.

imre 2024-12-12T11:12:10.328479Z

😅

imre 2024-12-12T11:12:22.126999Z

how about "invalidate caches and restart"

msolli 2024-12-12T11:13:07.021959Z

Doing it now, hold on...

msolli 2024-12-12T11:15:33.549749Z

Done, no change. â˜šī¸

msolli 2024-12-12T11:15:59.576429Z

Can you confirm my understanding, though, that it's supposed to work the way I outlined?

imre 2024-12-12T11:21:53.050839Z

> idea is that in the dev REPL, I should be able to load any namespace in any component, base and project, and also to be able to run any test in any component, base, or project I think this is correct, for the bases and components that are included in the :dev and :test aliases

imre 2024-12-12T11:22:17.669179Z

> I have a dev project (the root deps.edn file) with all of the bricks included in the :dev profile :extra-deps (as :local/root deps). There is also a :test alias that lists the test paths for all bricks under :extra-paths. this is what I also have

👍 1
imre 2024-12-12T11:22:47.002759Z

I don't do remote repl though, I'm not sure if that's contributing in any way

msolli 2024-12-12T11:23:42.203229Z

OK, what kind of REPL are you using? Local REPL from Cursive?

imre 2024-12-12T11:25:34.501949Z

local repl, nrepl, run with deps -A:dev:test

imre 2024-12-12T11:25:44.187519Z

root module

msolli 2024-12-12T11:26:24.034589Z

Yeah. just tried that, same result.

imre 2024-12-12T11:27:30.771269Z

if I read it right you can only access one of your components properly?

msolli 2024-12-12T11:28:39.091719Z

Yes, a component. Incidentally, maybe, is the first that is listed under "Project structure".

imre 2024-12-12T11:31:06.481769Z

that's strange

imre 2024-12-12T11:34:35.461419Z

ooc, idea/cursive version you're using?

msolli 2024-12-12T11:36:36.397089Z

Latest, I think: IDEA: Build #IU-243.21565.193, built on November 13, 2024 Cursive: 1.14.0-2024.3

imre 2024-12-12T11:37:05.218469Z

that should be recent enough

imre 2024-12-12T11:41:17.068059Z

have you tried pulling a public poly project and using it? there's https://github.com/imrekoszo/polylith-kaocha/ for example

imre 2024-12-12T11:41:32.702169Z

to see if you can repro

imre 2024-12-12T11:42:14.362559Z

I added a dev repl local repl config in the above that you can try running

msolli 2024-12-12T11:54:20.895539Z

Thanks, I'll try that one.

imre 2024-12-12T11:59:10.047649Z

my next steps would be to try and reduce the problem until you can compare it to something that works (in case the above does), or reduce it enough to be able to make it a public repro case

msolli 2024-12-12T12:05:21.829139Z

Your project works as expected: I can open the REPL and evaluate namespaces from components and bases. Thanks for this! I'll try to divide-and-conquer my own project.

msolli 2024-12-12T12:50:43.578299Z

Victory! đŸ’Ē I think it was the contents of a certain .idea/ClojureProjectSettings.xml file, that had some remnants of definitions for some older Leiningen-based projects (in the same monorepo). After deleting it and re-importing the root module it working as advertised. Thanks so much @imre for talking me through this!

👍đŸŧ 1
🎉 3