I have a two projects.
One of which is a library that the other project uses.
Let’s call them “the-project” and “the-library”.
the-library was (still is) on Clojars, as a built Maven artefact.
the-library is built with leiningen.
the-project uses CLI / build.tools (with a deps.edn) file.
This setup has worked for me fine, BUT, now I’m doing some more work on, and adding new stuff to, the-library. It’s new stuff in the-library, but largely being written to serve new requirements in the-project.
So, I want to move the-project off dependency on the Clojars version of the-library, and on to something more frequently and dynamically updated.
I could point the-project’s deps.edn to the actual workspace on my machine where I’m building the-library.
But the-project is also public and up on github. So I don’t want to do that. Instead I want to make the-project depend on and use the version of the-library currently on github.
I update the github of the-library more frequently than the Clojars version.
So I’ve changed the-project’s deps.edn from getting the-library from Clojars to getting it from github.
And that seems to be working OK when I build the dev version of the-project. The latest version of the-library is now downloaded into my ~/.gitlib directory. And being successfully used in the-project.
However when I try to build a prod version of the-project (which is meant to go into an uberjar), the build blows up with the following error
./build.sh
Building main.js
Building uberjar
Compiling the-project.server
Syntax error macroexpanding at (library-wrapper.cljc:1:1).
Execution error (FileNotFoundException) at the-project.the-library/loading (library-wrapper.cljc:1).
Could not locate the-library/maths__init.class, the-library/maths.clj or the-library/maths.cljc on classpath.
This may be because the classpath (clj -Spath) doesn’t seem to include any references to .gitlib And it doesn’t seem like this attempt to build the code for prod knows anything about looking in ~/.gitlib
But build.tools doesn’t seem to have any way to tell the build process where to look. AFAICT it’s meant to “just work” if the deps.edn contains a reference to the git repo in the :app clause. (Which contains all the dependencies I believe that both :dev and :prod use)
But it doesn’t. Should I even be expecting it to? And, if so, what am I likely to be missing? Where should be I looking to solve this?
Here’s one thing I have done. Given the-library its own deps.edn file. It doesn’t really have many dependencies, and it’s normally built with lein, but on the grounds that build.tools will need to build it, I gave it one.