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?
I'm assuming you've set Cursive up according to https://cursive-ide.com/userguide/polylith.html
Yes
and do you have dev and test ticked in your Clojure Deps tool window?
I don't use the clojure.test run configurations, though. I prefer running the tests in the REPL.
Yes
And have you tried doing a "refresh clojure deps projects"?
Oh yes, several times! đ And re-importing the root module (after removing all modules). And restarting IntelliJ.
đ
how about "invalidate caches and restart"
Doing it now, hold on...
Done, no change. âšī¸
Can you confirm my understanding, though, that it's supposed to work the way I outlined?
> 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
> 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
I don't do remote repl though, I'm not sure if that's contributing in any way
OK, what kind of REPL are you using? Local REPL from Cursive?
local repl, nrepl, run with deps -A:dev:test
root module
Yeah. just tried that, same result.
if I read it right you can only access one of your components properly?
Yes, a component. Incidentally, maybe, is the first that is listed under "Project structure".
that's strange
ooc, idea/cursive version you're using?
Latest, I think: IDEA: Build #IU-243.21565.193, built on November 13, 2024 Cursive: 1.14.0-2024.3
that should be recent enough
have you tried pulling a public poly project and using it? there's https://github.com/imrekoszo/polylith-kaocha/ for example
to see if you can repro
I added a dev repl local repl config in the above that you can try running
Thanks, I'll try that one.
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
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.
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!