tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
p-himik 2020-05-31T09:39:29.182200Z

Let me know if this is not the right place for this question. I'm trying to build an uberjar with depstar. It's my (almost) first attempt to do something like that. Going by this snippet from the README:

# generate pom.xml (or create it manually)
clojure -Spom
# build the uberjar with AOT compilation
clojure -A:depstar -m hf.depstar.uberjar MyProject.jar -C -m project.core
# Main-Class: project.core
java -jar MyProject.jar
Did all that in a very simple "hello world" project. Running that gives me
Error: Could not find or load main class project.core
Caused by: java.lang.ClassNotFoundException: project.core
I opened the jar with jd-gui and I see that there's indeed no project.core class even though the manifest mentions it. Running a non-AOT variant with java -jar MyProject.jar -m project.core works just fine. Are there some obvious steps that I might have missed? Or can it be an issue with depstar?

seancorfield 2020-05-31T09:45:17.182600Z

Is your project on GitHub so I can take a look @p-himik?

seancorfield 2020-05-31T09:46:28.183500Z

Does your project.core namespace have (:gen-class) in the ns form? Does it have a -main function?

seancorfield 2020-05-31T09:47:13.184400Z

(if you create an app project with clj-new, it'll have all the right bits in it that you need for an uberjar -- it'll even have the :aliases already set up in deps.edn)

p-himik 2020-05-31T10:22:56.185800Z

(:gen-class) seems to be it, thanks! I had no idea it was needed for -main with AOT. I'll try clj-new as well.