Closed opqdonut closed 3 years ago
depstar
is supposed to run as a "tool" -- via :replace-deps
, not :extra-deps
. It then computes a "basis" -- a classpath -- so it knows what goes into the JAR file. This is explained in the documentation.
In particular, if you need anything added to the JAR that is not part of your basic :deps
or :paths
, you need to tell depstar
about the aliases that would add those deps and paths to the classpath. See the example in the docs about web assets.
Here's what you should have in your deps.edn
file per the README, augmented for your project:
{
:aliases {
;; build an uberjar (application) with AOT compilation by default:
:uberjar {:replace-deps {com.github.seancorfield/depstar {:mvn/version "2.1.278"}}
:exec-fn hf.depstar/uberjar
:exec-args {:aot true ; unless you specifically do NOT want everything AOT'd
:main-class foo.main ; a symbol is fine here
:aliases [:build-target] ; specify the alias(es) to use for the classpath
:jar "target/foo.jar"}}
:build-target {:extra-paths ["build-target"]} ; specify additional classpath stuff
}
}
In particular, you do not want to use :aliases [:uberjar]
because that will cause all of depstar
and all of its dependencies to also be added to your uberjar.
Thanks for the thorough answer! I had tried :replace-deps
earlier but ran into some errors, but I got those sorted out now.
Hi,
Thanks for the tool! I'm probably missing something obvious here, but I have a problem with
:extra-paths
specified for my depstar alias not working unless I refer to the alias itself using:aliases
. Here's an example that works for me:However, before I added the
:aliases
the:extra-paths
wasn't getting obeyed. I'm not sure how this is possible, since I imagined thatclj
will process the:extra-paths
before calling the:exec-fn
.If this can be fixed on the depstar side, that would be nice, if not, a caveat in the docs would be nice.