leiningen

Marius 2022-08-19T12:29:54.904099Z

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
2022-08-19T13:51:24.154909Z

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

👍 1
2022-08-19T20:11:48.437589Z

Never got to it yet. Still on my TODO

2022-08-20T18:09:05.966289Z

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.

2022-08-20T18:11:59.708629Z

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

Marius 2022-08-20T19:04:52.161269Z

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

Marius 2022-08-20T19:06:02.808279Z

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

2022-08-20T19:42:32.881429Z

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

2022-08-25T16:35:15.525659Z

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

Marius 2022-08-25T19:44:08.876329Z

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