Fork me on GitHub

I work on a Java/JavaScript app, and I had the thought that I could start developing a kind of SDK to help myself and other devs with testing


it has zero Clojure in it right now


I'm guessing, if I want to start putting some in, I start with our gradle configuration? I've worked in Clojure far, far more than I've worked in Java

Jakub Holý (HolyJak)12:06:14

That is what I do. Check out #gradle


I think of Clojure app development as starting with lein new... so this is new territory

Alex Miller (Clojure team)20:06:24

I actually wrote up an example repo that you might find useful this week for calling from Java into Clojure


Stu also posted a clojure-from-java repo this week


It takes a very different approach -- one that I've taken myself in the past.

Alex Miller (Clojure team)20:06:27

yeah, I think mine is much less messy when you scale up

Alex Miller (Clojure team)20:06:59

as you just write a small fixed amount of shim, and then the rest is in clojure


I think the key, in either approach, is to try to keep the interop API small, but I like that Stu's involves no compilation: just package .clj files in with the Java using Maven (or "your current Java build tool").


It all gets more interesting when you start your Java app with the -D to get a Socket REPL going 🙂

Alex Miller (Clojure team)20:06:37

mine also does not require compilation

Alex Miller (Clojure team)20:06:32

they overlap, I just make the bolder step of suggesting you should actually write your Java API in Java


Oh, looking at the repo it seemed to build an uberjar and compile files... are those just the Java files?

Alex Miller (Clojure team)20:06:16

no aot or genclass there


it is sort of like, if I am a java dev and want to use a random clojure library, how would I do it vs. if I am clojure dev and want to provide a nice interface for java programmers how would I do it

Alex Miller (Clojure team)20:06:17

those are very different problems

Alex Miller (Clojure team)20:06:21

I'm targeting the latter

Alex Miller (Clojure team)20:06:24

for the former, that's not a use case Clojure is trying to target


there is some overlap in the solutions because they are both interoping in the same direction, but a different stance and priorities results in a different solution