leiningen

N.B. The maintainers are on #leiningen on Libera chat IRC. Go there for direct support/bug reports.
2021-03-19T08:17:22.004500Z

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

bastilla 2021-03-19T08:28:37.004700Z

Thanks @noisesmith Meanwhile the problem has resolved (as an issue in front of the screen as usual 😉 ) Regarding check and compile, I saw that compile sometimes doesn't catch faulty code (as severe as syntax errors - no joke). Obviously when it's not directly bundled (called) to the top level code you mentioned. shrugs

2021-03-19T16:01:36.005900Z

@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

2021-03-19T16:01:49.006300Z

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

2021-03-19T16:02:13.006900Z

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

2021-03-19T16:02:46.007400Z

defaulting to ~/.m2/respository

1👀
2021-03-19T16:25:29.012700Z

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

2021-03-19T16:26:31.013800Z

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

2021-03-19T16:32:51.017500Z

@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.

2021-03-19T16:34:01.018Z

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

2021-03-19T16:34:21.018500Z

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

2021-03-19T16:35:27.019300Z

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

2021-03-19T16:45:34.019900Z

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!

2021-03-19T16:54:34.020400Z

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

Endre Bakken Stovner 2021-03-19T18:14:23.021500Z

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?