Hi, I’m not sure where to start explaining to get the right context, but for short I’m trying to convert a somewhat large, working leiningen project to tools.deps. I’ve got the tools.deps + shadow-cljs dev experience working, but I’m struggling with the uberjar part.
The project is based on a Luminus template from 2017 so I haven’t done this part myself and I’m not an experienced Java developer either.
Right now I’m using this tool and guide (https://github.com/tonsky/uberdeps), but clj -Aclj -C:assets -e "(compile 'mtools.core)"
(“clj” and “assets” are actual aliases) seems to just hang and nothing is created in the “classes” dir. At the terminal I see some output from a (println) in a middleware ns and some WARNING: An illegal reflective access ...
and similar.
Any tips to help me along the way? E.g. how to get more verbose output from that compilation stage?
Hanging when running compile usually indicates you have a top level form doing something that blocks/takes a long time
I’m quite confused here. Does it run the code when it compiles? I’m surprised to see that println output as well to be honest.
It does
Aot compilation is the same as regular code loading, it just saves the bytecode to disk as it generates it
Likely your lein project was never aot compiled, because you would have experienced the same thing there
I’m quite confident that it was. Lein profile has :aot :all
and after extracting the jar I see lots of .class files
So when it hangs it might be the Immutant web server doing its job, waiting for connections?
Then you've made other changes than just switching from lein to deps.edn
It could be, it depends how you are starting it
I believe luminus uses mount to manage how and when things are started
I have certainly made quite a few changes, but not “that much” to that part of the code.
Yes, it uses mount.
Past tense?
typo
If you have something like (startmount)
as a top level form, it will start mount while running compile
Due to shadow-cljs liking to have all it’s source paths in one listing, I’m having to move away from the “env” approach used in Luminus. That is: Luminus uses source path to include different versions of a namespace in dev vs prod.
I might have messed something up in that ongoing process.
If you have a user.clj that starts mount when loaded
No user.clj, but mount is in core.clj that I call as main. Mount has actually bitten me quite a few times.
Would have been way easier if my project was open source. So, one way to get further is to start adding some printlns to my code, maybe?
Thanks, @hiredman at least I did learn something here. It’s time for dinner so I’ll be away for a while.