Fork me on GitHub

I am looking for something like a maven api that I can call from a Clojure app to make a .jar from a java file + it’s main class name. I’ve never used maven directly (at least not in anger). Any opinions here? For context: I am making a .jar and uploading it to a lambda-like service. Not about tool deps so I hope this is OK - seems like the place where I am most likely to get answers 🙂 Please reply in the thread


Please reply here to keep the channel tidy 🙂


@U0ALP2929 What service are you using? I created an AWS lambda-specific output for pack and would be interested in targetting others.


So hence lambda-like, it’s not exactly the same. However they accept a

--jar target/my-jar-with-dependencies.jar \
  --classname org.example.functions.WordCountFunction \


OK, looks like you need an uberjar of some kind in that case. I would recommend the library @U04V70XH6 maintains for that.


There's downsides to uberjars (which is why pack doesn't produce them), I'm curious to know if they accept anything else, so I'm reading the docs now :)


That's the one :)

simple_smile 4

Doesn't look positive for alternative forms. Unfortunate. Depstar is what I'd recommend :)


depstar looks like it is supposed to be used from the CLI, and not sure it supports .java files? I am looking for something to embed. I could always shell it / reach into the namespaces though


Oh, sorry, I thought you wanted to make a jar for clojure


Right, you don't need much at all


javac then zip jar.jar


that's it, you're done!


there might be an official java tool for making a jar, but zip works OK


@U0ALP2929 To build uberjars with depstar, you should be able to depend on the library and call hf.depstar.uberjar/run with the appropriate options -- see how the -main function sets those up. It assumes there's a pom.xml file available because it uses the presence of that to trigger some of the AOT and manifest generation stuff. It assumes, at a minimum, you've run clojure -Spom in a project, but you could probably generate a stub pom.xml as a temp file and pass that in.


And depstar works from the classpath -- so it will build a JAR from whatever is on your classpath which is very likely not what you're looking for 🙂


jar is the "official Java tool for making a jar" but it's basically just zip 🙂


Ahah I see 🙂 not what I am looking for indeed. Shelling to javac or even mvn looks like it could be the way then


I found this but I fear it may be a can of worms 😄