I have a monorepo with a few deps.edn
sub-projects. Some of the sub-projects depend on each other using :local/root
coordinates. I would like to build one of the sub-projects as an uberjar, but I am running into FileNotFoundException
exceptions that I can’t explain. Here is the relevant parts of the deps.edn
subproject that is being built.
{
...
:aliases {:uberjar {:extra-deps {com.github.seancorfield/depstar {:mvn/version "2.0.216"}
erp12/clark-core {:local/root "../clark-core"}
...}
:exec-fn hf.depstar/uberjar
:exec-args {:main-class erp12.clark.repl.main
:aot true :compile-ns :all :jar "clark-repl-test.jar"
:sync-pom true :group-id "erp12" :artifact-id "clark-repl" :version "0.0.1"}}}
...
}
Here is the error.
> clojure -X:uberjar
Execution error (FileNotFoundException) at erp12.clark.repl.main/loading (main.clj:1).
Could not locate erp12/clark/core/spark_session__init.class, erp12/clark/core/spark_session.clj or erp12/clark/core/spark_session.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
The missing file is in the erp12/clark-core
dependency from the :extra-deps
. The Depstar readme suggests that local root coordinates are supported, so my best guess is that I am missing some configuration. Does anyone have ideas what the problem might be? ThanksFirst off, you’re supposed to use :replace-deps
with depstar
— it runs as a tool, independent of your project — and then it computes the project basis based on the project deps.edn
and the aliases you provide to depstar
, and uses that separate classpath to figure out how to build the JAR file.
@erp12 You’re providing erp12/clark-core
as a dependency for the CLI to run depstar
itself which is pointless since depstar
doesn’t need it.
But if that isn’t part of your regular :deps
in the project deps.edn
, you need to tell depstar
which aliases to include — and you’ll want erp12/clark-core
under that alias.
You probably want something like this:
{
...
:aliases {:uberjar {:replace-deps {com.github.seancorfield/depstar {:mvn/version "2.0.216"}}
:exec-fn hf.depstar/uberjar
:exec-args {:main-class erp12.clark.repl.main
:aot true :compile-ns :all :jar "clark-repl-test.jar"
:aliases [:erp12]
:sync-pom true :group-id "erp12" :artifact-id "clark-repl" :version "0.0.1"}}
:erp12 {:extra-deps {
erp12/clark-core {:local/root "../clark-core"}
...}}
...
}
Note the :aliases
exec arg that will tell depstar
what aliases to use to compute the project basis, which is what goes into the JAR.