This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-27
Channels
- # babashka (35)
- # beginners (85)
- # cider (14)
- # clojure (115)
- # clojure-europe (15)
- # clojure-norway (2)
- # clojure-portugal (9)
- # clojure-uk (3)
- # clojurescript (28)
- # conjure (35)
- # data-science (10)
- # datomic (4)
- # graalvm (28)
- # holy-lambda (7)
- # hyperfiddle (2)
- # jobs (2)
- # joker (4)
- # malli (9)
- # meander (6)
- # nbb (6)
- # off-topic (23)
- # pathom (3)
- # remote-jobs (1)
- # shadow-cljs (158)
- # sql (15)
- # tools-deps (35)
- # vim (5)
@alexmiller "This branch is 8 commits ahead, 117 commits behind master." -- can we get t.d.a master
merged to add-lib3
, or is there some impediment to that now?
I just did a test merge locally and there are no conflicts, but I didn't attempt to run any tests etc.
Appreciated!
While trying clj -T:build jar
, I'm getting weird error I haven't seen before.
Execution error (ClassNotFoundException) at jdk.internal.loader.BuiltinClassLoader/loadClass (BuiltinClassLoader.java:641).\norg.objectweb.asm.Type\n
Anyone familiar? Any pointers are appreciated.Sounds like a version conflict somewhere in the dependencies. What is your :build
alias and what is the jar
task in build.clj
? Also, do you have more of a stacktrace?
> What is your :build alias
:build
{:extra-paths ["src"]
:extra-deps {io.github.clojure/tools.build
{:git/tag "v0.8.3" :git/sha "0d20256"}}
:ns-default build}
> Do you have more of a stacktrace?
It's a bit overloaded, but I couldn't decipher it. Let me dig a bit more, maybe I could still figure it out on my own.jar task:
(defn jar [_]
(b/write-pom {:class-dir class-dir
:lib lib
:version nil
:basis basis
:src-dirs ["src"]})
(build-cljs+css nil) ;; this can be ignored (the problem is not here)
(b/copy-dir {:src-dirs ["src" "resources"]
:target-dir class-dir})
(println "BUILD: Producing jar:" jar-file "...")
(b/compile-clj {:basis basis
:src-dirs ["src"]
:class-dir class-dir})
(b/uber {:class-dir class-dir
:uber-file jar-file
:basis basis
:manifest {"Main-Class" "iroh_front_end.server.system"}})
(println "BUID: Done building jar."))
So it's coming from compilation of some core.async
stuff that is referenced from iroh_front_end.shadow_cljs_helpers
whatever that is...?
you have some bogus dependency information somehow, core.async uses tools.analyzer.jvm, which has a dependency on the library where rg.objectweb.asm.Type comes from
so if org.objectweb.asm.Type is missing, somehow the jvm isn't being started with asm on the classpath
Yup, I was just about to ask how you compute basis
and whether you are missing some aliases there?
it would be very surprising to get tools.analyzer.jvm on the classpath, but not org.objectweb.asm.Type with any basis
it probably shouldn't even be compiling that file in the first place? I guess you use it for development stuff? I hope you are not using shadow-cljs in any production setup?
cljs recently (maybe months ago?) switched to a vendored version of some of the core libs because of clashes, I wonder if it is the cljs stuff in your build
Oh, so the issue it seems that I need a dependency (shadow-cljs) included, but it's in :extra-deps key in an alias.
how do I include deps in an alias with clj -T
?
doing clj -T:shadow-cljs:buld jar
, didn't work.
I tried clj -A:shadow-cljs -T:build jar
- still didn't work
(since CLJS compilation needs access to all your CLJS dependencies, so you'll just end up including your whole project, which build tasks aren't designed to do I guess)
It's somewhat confusing that your task is called jar
but it's actually building an uber
JAR 🙂
See https://clojure.github.io/tools.build/clojure.tools.build.api.html#var-create-basis for how to specify aliases when creating the basis.
That's where you would specify :shadow-cljs
rather than on the command-line.
But as Thomas says, you probably need to run a shadow build to generate JS and then copy that into your uberjar, rather than trying to run Clojure's compile-clj
with all the Shadow stuff included.
I would have expected that to be done via your build-cljs+css
function?
I mean if thats running a new JVM process thats fine, but if its running as part of the build task JVM thats not great
> I would have expected that to be done via your build-cljs+css function? that's what it does, but I also have shadow-cljs-helpers.clj, they need shadow-cljs dep included
build.clj
can easily spawn separate processes to run this stuff in isolation. That's what my build-clj
wrapper does for running tests, for example, and it provides for running arbitrary tasks in isolation too.