cursive 2025-03-05

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

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

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

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

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.

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

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.

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).

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.