Fork me on GitHub
#shadow-cljs
<
2022-11-27
>
fabrao16:11:15

Hello all, I don't know why but starting from 2.20.11 of shadow-cljs , I'm having problems to use build.clj and uber .

thheller16:11:43

why is shadow-cljs a part of that at all? none of shadow-cljs should end up in the uberjar?

fabrao16:11:01

I downgrade to 2.20.10 and the problem gone.

thheller16:11:22

that doesn't answer my question 😛

thheller16:11:38

what error do you get though?

fabrao16:11:36

sorry :rolling_on_the_floor_laughing:

fabrao17:11:01

I'm getting this error

Execution error (IllegalArgumentException) at clojure.tools.build.tasks.uber/explode (uber.clj:152).
/ is not a relative path

fabrao17:11:38

(b/uber {:class-dir class-dir
           :uber-file uber-file
           :basis     basis
           :exclude   ["LICENSE"]
           :main      'backend.application
           :manifest  {"Git-Revision" (str/trim-newline (:out (shell/sh "git" "rev-parse" "HEAD")))
                       "Git-Tags"     (->> (:out (shell/sh "git" "tag" "--points-at" "HEAD"))
                                           (str/split-lines)
                                           (str/join " "))
                       "Build-Time"   (.format (java.time.ZonedDateTime/now) (java.time.format.DateTimeFormatter/ISO_DATE_TIME))}})

fabrao17:11:01

(def class-dir "target/classes")
(def basis (b/create-basis {:project "deps.edn"}))
(def uber-file "target/app.jar")

fabrao17:11:09

I don't see anything related to shadow-cljs , but when I use 2.20.11it gives that error

thheller17:11:50

no clue what that means. might also be one of the deps I bumped in 2.20.11

thheller17:11:25

but I ask again. why is shadow-cljs involved in a uberjar creation? it absolutely under no circumstance should be in any uberjar ever

fabrao17:11:10

Sorry @thheller if I was not clear. As I referenced before, it does not have any reference to the uberjar process, I'm only referencing that in version 2.20.11 the problem shows up and I'm posting here the problem. When I use version 2.20.10 the problem is not happening.

thheller17:11:03

what I mean is: you seem to have shadow-cljs in deps.edn either directly or in an alias ACTIVE while building the uberjar

thheller17:11:22

that SHOULD NOT be done. put it into a cljs alias or whatever that is not active when building the uberjar

thheller17:11:01

but regardless I don't have a clue what the error means, or what to do about it

Apple17:11:59

https://clojurians.slack.com/archives/C6N245JGG/p1668750585171269 I had similar issue with .12 and .10 works. not necessarily an issue with shadow but one of those situation that java libs have conflict. the workaround for me is to use .10

fabrao17:11:59

Thank you Apple, I think it should be similar to my case too.

thheller17:11:45

those appear to be two entirely different errors though?

fabrao17:11:10

about the errors yes, but it's relate to using version 2.20.11-12

Apple17:11:53

I would just stick to .10 and feel that this is not worth looking into for now. It'll go away I believe.

thheller17:11:04

I doubt that. I mean your issue was a guava version conflict. that is not going to solve itself

Apple17:11:48

https://github.com/thheller/shadow-cljs/commit/2b143d0ce5046fb1af81bb9ea368cb4eb4ece5a6 this? remove guava dep

only added since the closure-compiler didn't properly declare
it itself. this is now fixed, so this is no longer needed.

thheller17:11:24

no, in your project. there is a guava conflict off some kind

thheller17:11:29

the closure-compiler has always depended on guava. but for a while it didn't declare it properly and just included it in its own jar

thheller17:11:40

no it is properly declared again and coming as an extra dep

thheller17:11:15

shadow-cljs only declared it temporarily, so it at least showed up in the dependency tree as a potential cause

thheller17:11:29

you may just add [com.google.guava/guava "31.0.1-jre"] to your own deps if that fixes anything

thheller17:11:39

or resolve the conflict, wherever your version came from

Apple18:11:46

you nailed it. adding com.google.guava/guava {:mvn/version "31.1-jre"} to deps.edn and how 2.20.12 works.

fabrao18:11:01

@zengxh 😀, I'm trying this now, because the 31.0.1-jre did not work to me

thheller18:11:07

@fabrao IMHO the only thing you should be looking for is REMOVING shadow-cljs from the dependencies that run when you build an uberjar

thheller18:11:29

I cannot emphasize this enough. you DO NOT WANT shadow-cljs in your uberjar

thheller18:11:05

so remove that. literally nothing else is relevant. if I could make it blow up every uberjar build that includes it I would. it just should not make it into any uberjar.

thheller18:11:41

and as a side effect it'll also fix your issue most likely

thheller18:11:54

shadow-cljs is a development tool

thheller18:11:58

it has no place in an uberjar

fabrao18:11:09

remove from where? I have this in my shadow-clj.edn -> :deps true

thheller18:11:18

and where do you have it in deps.edn

thheller18:11:43

I mean from that I can already tell

thheller18:11:47

and thats what I mean

thheller18:11:01

change your shadow-cljs.edn to be :deps {:aliases [:cljs]}

thheller18:11:16

then move the thheller/shadow-cljs dependency from the main deps to a :cljs alias

thheller18:11:42

(you may also move all other CLJS dependencies, since none of them are relevant in an uberjar either)

fabrao18:11:26

oh, right, I see the point

Apple18:11:59

i use shadow api to do compile/release so it's part of my deps.edn shadow itself will not be in the final uber so it's ok

Apple18:11:19

just want to save on jvm instances

thheller18:11:29

as long as its in an alias everything is fine

thheller18:11:48

top level is not recommended

Apple18:11:36

in my build i have 3 jars built: 1. java/clj lib 2. cljs 3. compiled clj sources written by me most of the time i only need to update part2, and sometimes part3 part1 only when i update lib deps.

fabrao19:11:05

@thheller removing it from main deps and using it in :alias worked. Thank you