Fork me on GitHub
#tools-deps
<
2020-06-17
>
mokr15:06:16

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?

hiredman15:06:28

Hanging when running compile usually indicates you have a top level form doing something that blocks/takes a long time

mokr15:06:54

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.

hiredman15:06:58

Aot compilation is the same as regular code loading, it just saves the bytecode to disk as it generates it

hiredman15:06:03

Likely your lein project was never aot compiled, because you would have experienced the same thing there

mokr15:06:49

I’m quite confident that it was. Lein profile has :aot :all and after extracting the jar I see lots of .class files

mokr15:06:32

So when it hangs it might be the Immutant web server doing its job, waiting for connections?

hiredman15:06:17

Then you've made other changes than just switching from lein to deps.edn

hiredman15:06:50

It could be, it depends how you are starting it

hiredman15:06:27

I believe luminus uses mount to manage how and when things are started

mokr15:06:11

I have certainly made quite a few changes, but not “that much” to that part of the code.

mokr15:06:16

Yes, it uses mount.

hiredman15:06:29

Past tense?

hiredman15:06:01

If you have something like (startmount) as a top level form, it will start mount while running compile

mokr15:06:14

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.

mokr15:06:49

I might have messed something up in that ongoing process.

hiredman15:06:55

If you have a user.clj that starts mount when loaded

mokr16:06:17

No user.clj, but mount is in core.clj that I call as main. Mount has actually bitten me quite a few times.

mokr16:06:38

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?

mokr16:06:07

Thanks, @hiredman at least I did learn something here. It’s time for dinner so I’ll be away for a while.