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
?Is your project on GitHub so I can take a look @p-himik?
Does your project.core
namespace have (:gen-class)
in the ns
form? Does it have a -main
function?
(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
)
(: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.