This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-19
Channels
- # aws (2)
- # babashka (4)
- # babashka-sci-dev (7)
- # beginners (92)
- # biff (7)
- # calva (64)
- # cider (2)
- # cljsrn (14)
- # clojure (8)
- # clojure-australia (5)
- # clojure-europe (14)
- # clojure-norway (8)
- # clojure-spec (36)
- # clojurescript (19)
- # component (15)
- # cursive (1)
- # data-science (6)
- # girouette (5)
- # hyperfiddle (3)
- # juxt (5)
- # leiningen (10)
- # lsp (7)
- # malli (12)
- # nbb (90)
- # polylith (1)
- # portal (11)
- # rdf (7)
- # reagent (6)
- # reitit (40)
- # remote-jobs (1)
- # shadow-cljs (21)
- # specter (5)
- # squint (83)
- # tools-deps (17)
- # vim (7)
Hi all! I’ve written here about my problem in mid June before, unfortunately I couldn’t find a solution (except for dirty workarounds).
The issue is as follows: My codebase contains both Clojure + Java, but the dependency is only clj->java. When compiling using the dev profile, the user.clj is pulled in, transitively referring to all clojure code.
For some reason, the Clojure code is compile before Java, causing a ClassNotFoundException. According to what I have read, this should not happen then compiling Java with lein javac
.
Now I was able to reduce this problem to a simple out-of-the-box project, which I created using a Luminus template, which you can find here: https://github.com/mkreis/lein-javac-problem
Try running lein javac
and the ClassNotFoundException will be thrown.
My hope is that someone can spot the issue and fix it. Thank you very much!!!
I looked briefly. I’m wishing the repro case wasn’t so loaded with all this luminus template stuff. It does make it harder to reason through. I’ll still give it a bit of an attempt.
In your example, I’m assuming that mycode
is the ns in question?
in this ns @ https://github.com/mkreis/lein-javac-problem/blob/main/src/clj/testapp/mycode.clj#L4 there is an (:import com.testapp.test.Test)
However, the actual Java class @ https://github.com/mkreis/lein-javac-problem/blob/main/src/java/com/testapp/Test.java is called com.testapp.Test
There is an extra “.test.” segment in your :import
.
I’d think perhaps this is a typo? Am I misreading or not reading the correct places?
@U02G3DBJ2SY
Hi @U0LK1552A, thank you so much for looking into this!!
Yes, it’s a typo, it should be (:import com.testapp.Test)
And sorry for adding more stuff to the project as really necessary. If you like, I can strip it further down?