Fork me on GitHub

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


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

👍 1

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


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.


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


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


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.


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


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 files altogether and just generate a manifest.


clear, thanks for a such detailed explanation