cursive

roklenarcic 2025-03-05T18:12:05.334809Z

I forgot how to REPL into build.clj files. Can someone help me out?

roklenarcic 2025-03-08T11:33:35.392269Z

Right… that tracks, but when I run the REPL, it won’t load the build namespace if I press the load namespace shortcut

roklenarcic 2025-03-08T11:34:17.435359Z

The tool library seems to have been added as described but I still don’t know how to run a REPL that would load that namespace

R.A. Porter 2025-03-05T18:18:31.886599Z

This might help: https://cursive-ide.com/userguide/deps.html#working-with-tools

roklenarcic 2025-03-05T18:20:54.217709Z

Doesn’t seem to cover this, plus nothing seems to appear in my libraries when I select the tool alias.

Hugh Powell 2025-03-05T21:56:08.303229Z

If I remember rightly build aliases tend to have a :deps key rather than an :extra-deps key. This overrides the default deps rather than adding to them. I've generally had to spin up a second REPL purely for the build alias because of this.

roklenarcic 2025-03-06T07:56:44.755529Z

But how do I spin up REPL that would include build.clj in its classpath?

cfleming 2025-04-10T05:58:36.345899Z

My apologies for not answering this at the time, it slipped under my radar. This is a bit tricky, I'll add it to the doc for the next release. The tools.build doc says: > Tools executed with -T:an-alias remove all project deps and paths, add "." as a path, and include any other deps or paths as defined in :an-alias. The magic incantation to achieve this in Cursive is: Local REPL, Run with Deps, and use this as the Options: -A:build -Sdeps '{:paths ["."]}'. However, there's a bug currently which prevents files being loaded into a REPL run like that: https://github.com/cursive-ide/cursive/issues/3023. That will be fixed in the next build, hopefully tomorrow.

Hugh Powell 2025-03-06T12:02:52.895739Z

Much like the :deps key you'll also need a :paths key for the build alias. That'll need to be a folder that (eventually) contains the build.clj file(s).

Hugh Powell 2025-03-06T12:05:38.150569Z

E.g. this is the build alias for one of my projects

{:aliases {:build      {:paths      ["infra"]
                        :deps       {io.github.clojure/tools.build {:mvn/version "0.10.7"}}
                        :ns-default build}}}
My build.clj file (and all the files it references) are inside a folder called infra that resides at the top of the project along side the traditional src and test folders.