Fork me on GitHub
#depstar
<
2020-09-21
>
sparkofreason20:09:04

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.

seancorfield20:09:24

@dave.dixon The -m option specifies the namespace that compile is run against so, no, you can't use -C without -m.

seancorfield20:09:07

And -m also determines the Main-Class: in the generated MANIFEST.

sparkofreason20:09:25

Maybe I need to add something to the class constructor to load clojure? Feels like I've had this issue before.

seancorfield20:09:08

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...

seancorfield20:09:28

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

seancorfield20:09:05

Step 2 can be just clojure -e '(compile 'your.entry.ns)' if that's where your :gen-class is

seancorfield20:09:36

As for initialization of Clojure for Google Cloud, no idea about that. Never tried to use any Google services.

seancorfield20:09:52

There's a #google-cloud channel that can probably answer that.

seancorfield20:09:22

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...

sparkofreason21:09:10

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.