This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-16
Channels
- # announcements (1)
- # aws (1)
- # babashka (14)
- # beginners (25)
- # biff (5)
- # calva (6)
- # clj-kondo (3)
- # cljsrn (7)
- # clojars (7)
- # clojure (26)
- # clojure-europe (13)
- # clojurescript (10)
- # code-reviews (1)
- # cursive (9)
- # datahike (3)
- # datomic (7)
- # depstar (5)
- # emacs (9)
- # garden (2)
- # graalvm (1)
- # helix (3)
- # jobs (1)
- # leiningen (2)
- # off-topic (1)
- # pathom (3)
- # re-frame (16)
- # reitit (3)
- # releases (1)
- # shadow-cljs (10)
- # spacemacs (6)
- # tools-deps (16)
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.