Fork me on GitHub
#depstar
<
2020-10-16
>
zetafish13:10:59

Why does depstar wants a pom.xml to acknowledge the --main option? I.e.

$ clj -X:uberjar
Ignoring -m / --main because no 'pom.xml' file is present!
Building uber jar: app.jar

seancorfield16:10:46

@zetafish If you build an uberjar with a specified main (namespace/class), depstar needs to build the manifest, the properties, and other "housekeeping" stuff that consumers of the JAR will need -- some of which comes from the pom.xml file.

👍 3
seancorfield16:10:33

You can use clojure -Spom to generate a skeleton pom.xml file (per the depstar readme).

seancorfield16:10:20

I could tease apart the manifest code from the pom properties code but, in general, if you're using --main, you're likely to be using -C for AOT as well so that the resulting uberjar can be executed via java -jar so you might as well create a proper pom.xml as well.

kirill.salykin17:10:20

so pom.xml not necessary required for the aot compilation, right? it is just needed to specify main?

seancorfield19:10:18

@U1V7K1YTZ AOT needs to know the entry point ns -- that's independent of the whole Main-Class thing.

seancorfield19:10:24

Strictly speaking, the pom.xml file isn't really needed for anything -- but, right now, depstar expects to read the group ID, artifact ID, and version from it, which are used in constructing some of the additional housekeeping pieces that end up in the JAR.

seancorfield19:10:39

-C (AOT) needs a namespace. java -jar needs a MANIFEST.MF file containing Main-Class:. In general, in the Clojure world, those two things tend to be conflated because there's an assumption that your "main" namespace will contain (:gen-class) and a -main function and that will be compiled to create the "main" class (of the same name as the namespace).

seancorfield19:10:57

In theory, the AOT entry ns and the main class can be different but in practice we almost never do that. And therefore depstar could omit the pom.xml and pom.properties files altogether and just generate a manifest.

kirill.salykin07:10:24

clear, thanks for a such detailed explanation