This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-16
Channels
- # atom-editor (6)
- # babashka (31)
- # beginners (34)
- # calva (1)
- # cider (21)
- # clj-kondo (5)
- # cljsrn (2)
- # clojars (6)
- # clojure (35)
- # clojure-europe (3)
- # clojure-norway (2)
- # clojurescript (4)
- # conjure (10)
- # cursive (8)
- # data-science (78)
- # fulcro (23)
- # graphql (10)
- # helix (2)
- # luminus (1)
- # off-topic (50)
- # other-languages (1)
- # pathom (8)
- # re-frame (9)
- # reagent (9)
- # reitit (1)
- # rewrite-clj (6)
- # shadow-cljs (134)
- # tools-deps (53)
- # vscode (1)
- # xtdb (4)
Example of how to create a regular uberjar for a babashka project: https://github.com/borkdude/babashka/issues/535#issuecomment-674518153
There was someone here mentioning a problem with --uberscript
and the order of namespaces being off. That should be fixed now on master.
$ clojure -A:depstar -m hf.depstar.uberjar MyProject.jar -m proj
Building uber jar: MyProject.jar
Processing pom.xml for {proj/proj {:mvn/version "0.1.0"}}
$ bb -jar MyProject.jar
:foo - failed: int?
I was discussing a possible deprecation of --uberscript
in favor of better support for uberjars, but maybe both have their place
I think uberscript still has a place. Nice for scripts with some small deps to set as executable and go.
I guess so yeah, because you can't just ./app.jar
and make the OS execute bb can you?
but on Windows that doesn't work altogether so bb -jar app.jar
would then be cross platform
I'm currently investigating if I can compile depstar to create an uberjar with bb itself...
One caveat: more memory usage and bigger binary but same issue as I had with including datafy: probably some part of clojure is touched, that pulls in a whole lot. Maybe it's the Clojure compiler itself, since depstar can do AOT
You can try the uberjar
branch:
$ bb -cp $(clojure -Spath) --uberjar foo.jar -m proj
Building uber jar: foo.jar
$ bb -jar foo.jar
:foo - failed: int?
Maybe it will be confusing that .jar
files compiled with bb cannot be run with Java because there is no compiled class, it's just a zip with clojure source files and a MANIFEST that says what the main namespace is
What I mean is:
borkdude@MBP2019 /tmp/proj $ bb -jar foo.jar
:foo - failed: int?
borkdude@MBP2019 /tmp/proj $ java -jar foo.jar
Error: Could not find or load main class proj
Caused by: java.lang.ClassNotFoundException: proj
But vice versa will work, uberjars compiled with Clojure (and bb compatible code) can be run with bb