leiningen

jumar 2022-08-10T10:14:39.775579Z

I'm facing a weird problem with new leiningen version 2.9.9. It seems to include user.clj file from one of the dependencies in the uberjar while the user.clj is only supposed to be used for the dev profile - it is not included in source paths for uberjar profile. It all worked well with 2.9.8 and we actually noticed this only after leiningen on our CI machines (github actions) got updated to 2.9.9 Any idea why is that or somebody with the same problem?

jumar 2022-08-10T10:15:33.730749Z

Our problem then is, that this user.clj is automatically loaded by Clojure and since it's referring to a dev-only dependency the app fails to start in production settings.

vemv 2022-08-10T10:34:15.888109Z

do you mean it's pulling the user.clj from a dependency such as [medley "1.4.0"] ? (totally fictional example)

jumar 2022-08-10T10:38:24.337909Z

it's pulling user.clj from our internal lib which is set as a dependency of the project. The user.clj ends up in the uberjar's root 'folder'.

jumar 2022-08-10T10:38:43.227489Z

It seems like it's activating dev profile by default.

jumar 2022-08-10T10:39:15.813079Z

I'm now looking at how to downgrade leiningen to 2.9.8 on github actions runner but not sure about the best approach here. The runners come with 2.9.9 preinstalled.

vemv 2022-08-10T10:41:08.440229Z

> from our internal lib which is set as a dependency of the project. what does this mean? is it a vanilla dependency? Where I want to go is: if a dependency, as a .jar, was packaged including a user.clj, that's the root cause, lein uberjar only unveils that condition

jumar 2022-08-10T10:43:39.780989Z

It should not be packaged because it's in the source path defined only in dev profile Again, it all worked in2.9.8

jumar 2022-08-10T10:45:16.747369Z

Could it be something with lein install activating the dev profile by default?

vemv 2022-08-10T10:45:59.274319Z

I find there's a contradiction in your problem statement. Maybe it worked only by chance > It should not be packaged because it's in the source path defined only in dev profile lein uberjar uberjars other dependencies. It doesn't build those dependencies. It doesn't know anything about those project's dev profiles maybe you're using a monolithic build system via some Lein plugin?

πŸ‘ 1
jumar 2022-08-10T10:46:14.180159Z

During our build, we first call lein install to store the dependency in the local repo

vemv 2022-08-10T10:47:18.044559Z

so that's different from lein uberjar wdyt of updating that command to lein with-profile -dev install ?

jumar 2022-08-10T11:51:50.058549Z

Thanks for the suggestion - I'll try that. Nevertheless, it looks to me like a pretty serious regression in leiningen - tricky and hard to debug.

jumar 2022-08-10T11:54:09.595059Z

And I didn't see it mentioned here: https://github.com/technomancy/leiningen/releases

vemv 2022-08-10T12:06:27.826479Z

idk For a few years I've invoked all important commands with an with-profile -dev - one never knows when that implicit profile might be activated anyway, if you can isolatedly repro that lein install started activating the dev profile, that surely would be a welcome issue report

πŸ‘ 2
jumar 2022-08-10T12:17:32.468349Z

Yes, I'll remember that πŸ™‚ Thanks for your help!

🍻 1
eskos 2022-08-10T13:03:49.791009Z

This is a known bug in 2.9.9, as soon as it was noticed yesterday technomancy jumped on it and started fixing it. It is recommended to stay on 2.9.8 and wait until 2.9.10 if possible; the bug has been fixed, but turns out to be one of those things where fixing one bug introduces another one. Because of move to Codeberg there’s nothing on the GitHub side about this; the issue in question is being tracked here https://codeberg.org/leiningen/leiningen/issues/5 Recommended workaround is lein with-profile production uberjar

jumar 2022-08-10T14:58:42.434629Z

Thanks! Indeed, I noticed that even with lein with-profile -dev install it still fails because lein uberjar run on the main project still includes user.clj from the main project - the difference is that it's AOT-compiled and fails with a different error at runtime.

vemv 2022-08-10T15:06:39.486839Z

Wouldn't lein with-profile -dev uberjar fix that?

jumar 2022-08-10T15:07:22.458649Z

Probably, but we were talking about lein install before.

jumar 2022-08-10T15:08:08.988749Z

Also, I lean toward with-profile production if that actually works.

vemv 2022-08-10T15:09:25.490609Z

well, the bug mutated :) I'd recommend to be careful with profiles for every important invocation, it's part of Lein mastery imo with-profile production deactivates other profiles (given lack of + or -) may or may not be what you want

jumar 2022-08-10T15:11:46.696089Z

Yeah, I must agree with this πŸ™‚ > I'd recommend to be careful with profiles for every important invocation, it's part of Lein mastery imo

Yuner Bekir 2022-08-10T14:09:19.516439Z

Hello guys! I am trying to invoke an alias in a child (sub) project which is consisted of multiple other sub projects, while running an alias from the parent project. Is there a way to do it?

vemv 2022-08-10T14:20:19.249589Z

are you using a plugin like lein-sub, lein-monolith? (those would be some valid answers)

Yuner Bekir 2022-08-10T14:27:50.878579Z

I have lein-sub and am trying the following and have the error

vemv 2022-08-10T15:46:59.604219Z

could you post the entire stacktrace? until the very bottom (sometimes it's N stacktraces)

vemv 2022-08-10T15:51:34.400089Z

a quick thing you can try is changing the command to with-profile +test eastwood I'll be back in a few hours. Would love to help (I maintain Eastwood and have solved sub issues in the past)

πŸ™Œ 1
Yuner Bekir 2022-08-10T15:55:50.115369Z

lein eastwood-all
Reading project from connectors
Reading project from zendesk
java.lang.Exception: Error loading zendesk/project.clj
 at leiningen.core.project$read_raw$fn__8045.invoke (project.clj:1101)
    leiningen.core.project$read_raw.invokeStatic (project.clj:1095)
    leiningen.core.project$read_raw.invoke (project.clj:1091)
    leiningen.core.project$read.invokeStatic (project.clj:1112)
    leiningen.core.project$read.invoke (project.clj:1109)
    leiningen.core.project$read.invokeStatic (project.clj:1113)
    leiningen.core.project$read.invoke (project.clj:1109)
    leiningen.sub$apply_task_to_subproject.invokeStatic (sub.clj:11)
    leiningen.sub$apply_task_to_subproject.invoke (sub.clj:7)
    leiningen.sub$sub.invokeStatic (sub.clj:51)
    leiningen.sub$sub.doInvoke (sub.clj:46)
    clojure.lang.RestFn.invoke (RestFn.java:425)
    clojure.lang.AFn.applyToHelper (AFn.java:156)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$partial_task$fn__7330.doInvoke (main.clj:284)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$apply_task.invokeStatic (main.clj:334)
    leiningen.core.main$apply_task.invoke (main.clj:320)
    leiningen.sub$apply_task_to_subproject.invokeStatic (sub.clj:13)
    leiningen.sub$apply_task_to_subproject.invoke (sub.clj:7)
    leiningen.sub$sub.invokeStatic (sub.clj:51)
    leiningen.sub$sub.doInvoke (sub.clj:46)
    clojure.lang.RestFn.invoke (RestFn.java:425)
    clojure.lang.AFn.applyToHelper (AFn.java:156)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$partial_task$fn__7330.doInvoke (main.clj:284)
    clojure.lang.RestFn.applyTo (RestFn.java:139)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$apply_task.invokeStatic (main.clj:334)
    leiningen.core.main$apply_task.invoke (main.clj:320)
    leiningen.core.main$resolve_and_apply.invokeStatic (main.clj:343)
    leiningen.core.main$resolve_and_apply.invoke (main.clj:336)
    $do.invokeStatic (do.clj:40)
    $do.doInvoke (do.clj:32)
    clojure.lang.RestFn.applyTo (RestFn.java:139)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$partial_task$fn__7330.doInvoke (main.clj:284)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$apply_task.invokeStatic (main.clj:334)
    leiningen.core.main$apply_task.invoke (main.clj:320)
    leiningen.core.main$resolve_and_apply.invokeStatic (main.clj:343)
    leiningen.core.main$resolve_and_apply.invoke (main.clj:336)
    leiningen.core.main$_main$fn__7419.invoke (main.clj:453)
    leiningen.core.main$_main.invokeStatic (main.clj:442)
    leiningen.core.main$_main.doInvoke (main.clj:439)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:665)
    clojure.main$main_opt.invokeStatic (main.clj:514)
    clojure.main$main_opt.invoke (main.clj:510)
    clojure.main$main.invokeStatic (main.clj:664)
    clojure.main$main.doInvoke (main.clj:616)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.main.main (main.java:40)
Caused by: java.io.FileNotFoundException: zendesk\project.clj (The system cannot find the path specified)
 at java.io.FileInputStream.open0 (FileInputStream.java:-2)
    java.io.FileInputStream.open (FileInputStream.java:195)
    java.io.FileInputStream.<init> (FileInputStream.java:138)
    java.io.FileInputStream.<init> (FileInputStream.java:93)
    clojure.lang.Compiler.loadFile (Compiler.java:7571)
    clojure.lang.RT$3.invoke (RT.java:327)
    leiningen.core.project$read_raw$fn__8045.invoke (project.clj:1099)
    leiningen.core.project$read_raw.invokeStatic (project.clj:1095)
    leiningen.core.project$read_raw.invoke (project.clj:1091)
    leiningen.core.project$read.invokeStatic (project.clj:1112)
    leiningen.core.project$read.invoke (project.clj:1109)
    leiningen.core.project$read.invokeStatic (project.clj:1113)
    leiningen.core.project$read.invoke (project.clj:1109)
    leiningen.sub$apply_task_to_subproject.invokeStatic (sub.clj:11)
    leiningen.sub$apply_task_to_subproject.invoke (sub.clj:7)
    leiningen.sub$sub.invokeStatic (sub.clj:51)
    leiningen.sub$sub.doInvoke (sub.clj:46)
    clojure.lang.RestFn.invoke (RestFn.java:425)
    clojure.lang.AFn.applyToHelper (AFn.java:156)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$partial_task$fn__7330.doInvoke (main.clj:284)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$apply_task.invokeStatic (main.clj:334)
    leiningen.core.main$apply_task.invoke (main.clj:320)
    leiningen.sub$apply_task_to_subproject.invokeStatic (sub.clj:13)
    leiningen.sub$apply_task_to_subproject.invoke (sub.clj:7)
    leiningen.sub$sub.invokeStatic (sub.clj:51)
    leiningen.sub$sub.doInvoke (sub.clj:46)
    clojure.lang.RestFn.invoke (RestFn.java:425)
    clojure.lang.AFn.applyToHelper (AFn.java:156)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$partial_task$fn__7330.doInvoke (main.clj:284)
    clojure.lang.RestFn.applyTo (RestFn.java:139)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$apply_task.invokeStatic (main.clj:334)
    leiningen.core.main$apply_task.invoke (main.clj:320)
    leiningen.core.main$resolve_and_apply.invokeStatic (main.clj:343)
    leiningen.core.main$resolve_and_apply.invoke (main.clj:336)
    $do.invokeStatic (do.clj:40)
    $do.doInvoke (do.clj:32)
    clojure.lang.RestFn.applyTo (RestFn.java:139)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$partial_task$fn__7330.doInvoke (main.clj:284)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$apply_task.invokeStatic (main.clj:334)
    leiningen.core.main$apply_task.invoke (main.clj:320)
    leiningen.core.main$resolve_and_apply.invokeStatic (main.clj:343)
    leiningen.core.main$resolve_and_apply.invoke (main.clj:336)
    leiningen.core.main$_main$fn__7419.invoke (main.clj:453)
    leiningen.core.main$_main.invokeStatic (main.clj:442)
    leiningen.core.main$_main.doInvoke (main.clj:439)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:665)
    clojure.main$main_opt.invokeStatic (main.clj:514)
    clojure.main$main_opt.invoke (main.clj:510)
    clojure.main$main.invokeStatic (main.clj:664)
    clojure.main$main.doInvoke (main.clj:616)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.main.main (main.java:40)

vemv 2022-08-11T09:22:27.094489Z

So far I have no clue :) I don't see eastwood in the stacktrace. Does the error happen with any other command? e.g. deps

Yuner Bekir 2022-08-11T15:24:41.011509Z

it works fine. These are my subprojects. The connectors project contains all other projects. For some reason if I try to run lein sub eastwood it fails when I have the connectors sub project in the list, but works fine for the others

πŸ‘ 1
vemv 2022-08-11T18:59:16.317349Z

So as mentioned, since I see no eastwood in the stacktrace it's hard to tell what's happening -_- Could you create a repro project and report it as an issue in eastwood?

vemv 2022-08-11T18:59:42.364519Z

Also, @kumarshantanu does this lein-sub issue look familiar?

Yuner Bekir 2022-08-12T06:39:05.940189Z

I will create a dummy project

Yuner Bekir 2022-08-12T07:32:19.585629Z

https://github.com/yunerbekir/clojure-nested-eastwood here it is. try running lein sub eastwood in the root directory and you will get an error. What I expect to happen is that it will trigger sub eastwood inside the nested project

πŸ‘ 1
Shantanu Kumar 2022-08-12T11:04:37.338479Z

@yuner.bekir Thanks for the repro project. I am able to reproduce the error, which appears to be due to nested use of lein-sub i.e. using lein-sub in a sub-project. I will look into it soon. /cc @vemv

πŸ‘ 1
πŸ™Œ 1
vemv 2022-08-12T11:08:34.177509Z

Thanks, I was looking at it :) that saves me much debugging time. Probably having deeply nested projects is not a best practice anyway. Also, these days Eastwood latest is 1.2.4 !

Yuner Bekir 2022-08-12T11:10:40.789439Z

Thanks for your help. I think the issue here is related to sub and not eastwood.