Fork me on GitHub

Hi, What's the reason lein deps does not retrieve the ring-codec jar when I do not explicitly mention ring-codec as a dependency in project.clj? Because of this lein run has to retrieve the jar first which deteriorates startup time. Is including ring-codec in project.clj the best way to prevent this?

$ lein deps # ring-codec not included as dependency in project.clj
Retrieving ring/ring-codec/1.1.2/ring-codec-1.1.2.pom from clojars

$ rm -rf ~/.m2/repository/ring/ring-codec/1.1.2

$ lein deps # ring-coded included as dependency in project.clj
Retrieving ring/ring-codec/1.1.2/ring-codec-1.1.2.pom from clojars
Retrieving ring/ring-codec/1.1.2/ring-codec-1.1.2.jar from clojars


@uiltjesrups you need to have all deps pulled your project uses. these are not limited to only those you directly/explicitly specify in your project.clj. you also have to pull in all of your dependencies’ depencencies, and transitively all of theirs


so deps form a tree of deps, and those deps’ deps, and so on


lein shouldn’t need to pull this every time under standard setup since it caches it to your local repository - on the machine lein is ran


defaulting to ~/.m2/respository

👀 3

@uiltjesrups that situation makes me think your run task uses some plugin adding deps that the default project doesn't include


I never call "lein deps", it's a subtask that nearly every other task calls for you


@noisesmith Thanks, it might be the lein duct plugin, I will try it out. I use lein deps in my dockerfile, so all dependencies are pulled during building the image.


if you build a fat jar instead of using lein inside the docker image, you don't have to worry about any of that


(also you get better startup time and a simpler container setup)


also this allows switching painlessly to clj (or whatever else gets invented), as all you need inside the container for the clojure code to work is a jvm and a jar


I started with that but ran into problems (long story) and lein run was a quick solution, I thought... You convinced me to do it the right way anyway. Thanks!


note that using an uberjar does not require aot - you can use clojure.main

Endre Bakken Stovner18:03:23

When trying to start lein repl I get the error message Caused by: java.lang.RuntimeException: Unable to resolve symbol: create in this context. Does anyone know what I might be doing wrong?