tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
mokr 2020-06-17T15:24:16.373900Z

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?

2020-06-17T15:40:28.376500Z

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

mokr 2020-06-17T15:42:54.378600Z

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.

2020-06-17T15:43:15.379100Z

It does

2020-06-17T15:43:58.380200Z

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

2020-06-17T15:45:03.381900Z

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

mokr 2020-06-17T15:46:49.383400Z

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

mokr 2020-06-17T15:47:32.384400Z

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

2020-06-17T15:48:17.385700Z

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

2020-06-17T15:48:50.386700Z

It could be, it depends how you are starting it

2020-06-17T15:49:27.387900Z

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

mokr 2020-06-17T15:50:11.388700Z

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

mokr 2020-06-17T15:50:16.388900Z

Yes, it uses mount.

2020-06-17T15:50:29.389300Z

Past tense?

mokr 2020-06-17T15:50:35.389600Z

typo

2020-06-17T15:52:01.392700Z

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

mokr 2020-06-17T15:52:14.393100Z

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.

mokr 2020-06-17T15:52:49.394200Z

I might have messed something up in that ongoing process.

2020-06-17T15:52:55.394500Z

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

mokr 2020-06-17T16:00:17.395700Z

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

mokr 2020-06-17T16:02:38.397900Z

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?

mokr 2020-06-17T16:05:07.399100Z

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