I'm trying to compile an uberjar for deployment as a Google could function. Can I AOT using depstar without specifying a Main-Class? The cloud function framework just wants to reflect on the jar and find a particular class implementation. I tried with "-m", but it complains that it can't find clojure core__init.class.
@dave.dixon The -m
option specifies the namespace that compile
is run against so, no, you can't use -C
without -m
.
And -m
also determines the Main-Class:
in the generated MANIFEST.
Maybe I need to add something to the class constructor to load clojure? Feels like I've had this issue before.
If you don't want to specify a Main-Class:
, you can still create an uberjar with AOT'd code but you have to do it more manually...
1. create classes
folder
2. manually compile
the namespace(s) you need for actual classes
3. build an uberjar (without -C
and without -m
) via an alias that adds :extra-paths ["classes"]
so the compiled code is on the classpath and therefore will get added to the JAR
Step 2 can be just clojure -e '(compile 'your.entry.ns)'
if that's where your :gen-class
is
As for initialization of Clojure for Google Cloud, no idea about that. Never tried to use any Google services.
There's a #google-cloud channel that can probably answer that.
Feel free to @ me into that channel if you get advice that doesn't easily translate to depstar
and I'll try to help out...
Thanks, I got it to build via this route, though it still has to issue not finding core__init.class. I have a recollection that when compiling a library of classes to be reflected, there's something you need to do to get clojure initialized, stuff that otherwise would happen through clojure.main
.
I think it was something like this: https://groups.google.com/g/clojure/c/Aa04E9aJRog