Fork me on GitHub
#integrant
<
2023-09-18
>
wevrem00:09:22

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?

wevrem01:09:22

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.

wevrem01:09:40

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.

weavejester22:09:32

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.