This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-18
Channels
- # announcements (10)
- # babashka (21)
- # beginners (99)
- # biff (66)
- # catalyst (3)
- # cherry (1)
- # cider (11)
- # clojure (38)
- # clojure-austin (3)
- # clojure-dev (23)
- # clojure-europe (21)
- # clojure-hungary (10)
- # clojure-nl (2)
- # clojure-norway (57)
- # clojure-uk (2)
- # clojurescript (9)
- # cursive (6)
- # fulcro (5)
- # hyperfiddle (14)
- # integrant (4)
- # introduce-yourself (3)
- # lsp (24)
- # off-topic (14)
- # reagent (12)
- # reitit (13)
- # releases (8)
- # sci (16)
- # shadow-cljs (8)
- # solo-full-stack (1)
- # spacemacs (5)
- # squint (3)
- # xtdb (14)
I have a problem/question which I’m sure is all coming from my own ignorance.
1. I’m working on a full-stack project.
2. I created a little side project to focus on a very specific piece of functionality, and plan to keep it separate and use it as a local library.
3. The side project includes an http server and a small reagent app that I fired up and used during development. Thus the library contains both Clojure and ClojureScript namespaces…
4. …But in the larger project, I’ll only need some of the ClojureScript namespaces. The server and app were just for me for development.
5. Back in the large project, I’ve added the library as a :local-root
entry in deps.edn and started up the REPL. So far so good.
6. When I run Integrant-REPL (reset)
, it tries and fails to load all the Clojure namespaces from the local library.
7. That was a surprise to me. I haven’t yet :require
-ed anything from the local library, whether Clojure or ClojureScript. I was just getting ready by adding it in deps.edn
. And when I do start using them, it will only be some of the ClojureScript namespaces.
Is this something to do with Integrant-REPL? How do I tell it to not bother with the Clojure namespaces in that local library?
Or is this something I haven’t done properly in setting up my library? I mean, integrant isn’t trying to load Clojure namespaces from any of the other projects I’ve listed as dependencies, why my local library? I also realize that integrant uses tools.namespaces which is where this error is really coming from.
OK. I think I figured it out. I had one namespace in the library, it was my adapter, that was :require
-ing a namespace not in the main src
folder, but in a separate env/dev/src
folder. Those sources under env
are not on the classpath so tools.namespaces chokes when examining adapter
. There is really no reason for adapter
to be in the main src
folder, so I just moved it over to env
. Now everything under src
refers only to other namespaces that are also under src
and tools.namespaces is happy and I am able to use my local library within my large project.
I guess what I learned is that I can’t be sloppy in my own local library, because tools.namespace is going to probe to every corner and it won’t know about namespaces that are only reached via :extra-paths
under a development-only alias.
Glad you found the solution. I wonder if it might be an idea to look for refresh directories automatically by looking for file:// classpath entries.