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'll try this out in an hour or so.
Never got to it yet. Still on my TODO
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?
@mail990
Hi @mikerod, 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?
Its ok. I'll look a bit more and see.
I’ve been way side tracked this week. I haven’t forgetten about this, but still haven’t been able to look.
Hi Mike, no worries! I am super grateful that you’re willing to invest your time and therefore I’m happy to wait.