Fork me on GitHub
#leiningen
<
2021-04-22
>
haywood14:04:14

👋:skin-tone-2: hey gang, wanted to see if I’m thinking about this correctly. I have a clojure codebase and I want to add a couple .cljc namespaces to it and create a jar that only includes those namespaces using a separate profile for consumption as a library in a clojurescript project. Is that necessary or should I just create a single jar for the whole thing?

noisesmith15:04:43

in my experience adding more jars / configs with different subsets of jars tends to lead to errors and slow down processes

noisesmith15:04:14

and what do you gain? there aren't files in the jar that you don't use in one app - that's a small benefit for the added work and fragility IMHO

Clément Ronzon21:04:16

Hey gals and guys, After setting up a Docker container based on clojure:openjdk-11-lein I am able to run lein commands such as lein ancient, lein repl and such. Nevertheless It seems that the first time I run those lein commands it downloads the dependencies for each and every different commands (`lein ancient`, lein repl, lein test-refresh etc.). Is there an explanation for that behavior? Is it possible to prevent the download of the same deps multiple times to save bandwidth and time ?

andy.fingerhut01:04:58

The explanation for that behavior is that at least some, and perhaps all, of those commands need different JAR files retrieved from the Maven central repository and/or Clojars, or they cannot run, because those JAR files are not already on the system where you ran those commands. They are cached in your ~/.m2 directory after you run those commands the first time, so the second time you run them it should not download them again.

andy.fingerhut01:04:30

If you create the Docker container in such a way that those files are already present in the container, then running those commands should not download them again.

noisesmith13:04:55

IMHO the superior option is not to run lein inside docker (unless the container is only for CI jar building) and instead use lein to build a jar, and use that jar from docker. This eliminates other complexities like pre-populating / reusing the m2 cache and eliminates a variety of transient / situational failures to reproduce behavior.

noisesmith13:04:50

also it's less demanding on your container resources in your prod environment

Clément Ronzon15:04:01

Thank you @U0CMVHBL2 and @U051SS2EU! The container is for dev env. only. The ~/.m2 dir is mapped to a volume so the cache is not lost between container's ups and downs. You are right @U0CMVHBL2, it happens only the first time the lein commands are ran. In any case this is not a big deal, I was just curious. Thanks again!