depstar

Discussion around https://github.com/seancorfield/depstar
zetafish 2020-10-16T13:33:59.021100Z

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

seancorfield 2020-10-16T16:48:46.023100Z

@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
seancorfield 2020-10-16T16:49:33.023700Z

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

seancorfield 2020-10-16T16:53:20.025300Z

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.salykin 2020-10-17T07:31:24.027700Z

clear, thanks for a such detailed explanation

kirill.salykin 2020-10-16T17:08:20.026700Z

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

seancorfield 2020-10-16T19:16:18.026900Z

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

seancorfield 2020-10-16T19:17:24.027100Z

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.

seancorfield 2020-10-16T19:19:39.027300Z

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

seancorfield 2020-10-16T19:20:57.027500Z

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.