This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-25
Channels
- # announcements (8)
- # babashka (58)
- # beginners (59)
- # biff (4)
- # calva (39)
- # cider (2)
- # clj-kondo (8)
- # clj-together (4)
- # cljdoc (5)
- # cljsrn (1)
- # clojure (60)
- # clojure-australia (2)
- # clojure-europe (16)
- # clojure-nl (1)
- # clojure-norway (3)
- # clojurescript (13)
- # conjure (10)
- # cursive (9)
- # datomic (5)
- # dev-tooling (1)
- # emacs (6)
- # events (1)
- # graalvm (38)
- # graphql (5)
- # joyride (1)
- # kaocha (3)
- # lsp (23)
- # malli (2)
- # mount (2)
- # off-topic (31)
- # other-languages (13)
- # pathom (3)
- # polylith (12)
- # portal (4)
- # practicalli (22)
- # re-frame (6)
- # reagent (3)
- # releases (3)
- # sql (4)
- # squint (3)
- # tools-build (10)
- # tools-deps (10)
- # xtdb (4)
I haven't been using tools-build much in the past so I'm trying to learn it a bit. I've just generated a new project using clj-new
clojure -Tclj-new lib :name myname/mylib
Now, I can run a REPL within my Emacs (Cider) and play with the app.
However, I'm wondering how should I iterate on the build script itselfs (build.clj)?
When I run the standard repl build-clj isn't available.
Should I run clj -A:build
?If I do that I don't seem to be able to require the build
ns:
clj -A:build
...
(require 'build)
Execution error (FileNotFoundException) at user/eval1 (REPL:1).
Could not locate build__init.class, build.clj or build.cljc on classpath.
The guide says this: https://clojure.org/guides/tools_build
> • This is just normal Clojure code - you can load this namespace in your editor and develop it interactively at the REPL.
But it doesn't say anything about how to do that.
Using clj -A:build
I can at least require tools.build API:
(require '[clojure.tools.build.api :as b]
But what about the build
ns itself?Looking in the cider docs now I tried: https://docs.cider.mx/cider/basics/middleware_setup.html#using-tools-deps
:cider-build {:deps {io.github.seancorfield/build-clj
{:git/tag "v0.8.2" :git/sha "0ffdb4c"}}
;; see
;; - check for the newest version
:extra-deps {cider/cider-nrepl {:mvn/version "0.28.7"}}
:main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]
:ns-default build}
Then
clj -M:build
nREPL server started on port 52326 on host localhost -
Then cider-connect
from within Emacs.
That kinda works I suppose - it's a bit tricky to manage but standard app REPL and the "build" REPL but it seems to be loading.@U06BE1L6T You can explicitly add the current dir the the classpath with :paths ["."]
Oh I see,
then maybe it's better to move build.clj to a separate directory (like build/build.clj
)
Or just eval the build.clj
file in your editor -- it shouldn't matter whether it's on the path or not.