Fork me on GitHub
#leiningen
<
2022-08-19
>
Marius12:08:54

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!!!

👍 1
mikerod13:08:24

I'll try this out in an hour or so.

👍 1
mikerod20:08:48

Never got to it yet. Still on my TODO

mikerod18:08:05

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.

mikerod18:08:59

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

Marius19:08:52

Hi @U0LK1552A, thank you so much for looking into this!! Yes, it’s a typo, it should be (:import com.testapp.Test)

Marius19:08:02

And sorry for adding more stuff to the project as really necessary. If you like, I can strip it further down?

mikerod19:08:32

Its ok. I'll look a bit more and see.

mikerod16:08:15

I’ve been way side tracked this week. I haven’t forgetten about this, but still haven’t been able to look.

Marius19:08:08

Hi Mike, no worries! I am super grateful that you’re willing to invest your time and therefore I’m happy to wait.