1

I'm doing a java project with some friends of mine, using intellij as IDE and gradle to build the project, recently I started learning clojure and I'd like to include Clojure code in our java project, as we know if it was Lein handling the project I coud easely interop both java and clojure with each other, but my friends have no interest in using Clojure or changing the project structure (understandably of course), is there anyway I can keep the development using gradle and intellij without having to compile Clojure into jar and include it has a external dependency? (use gradle so it can build the java and clojure in the same project or something like that) I already tried finding plugins but I couldnt get it to build the project from intellij has it would keep getting errors... Thanks in advance for the responses.

Tzeroxik
  • 29
  • 6
  • I could, but if I wanted to receive objects implemented in java it would complicate a bit, and I'd like to have the project under one IDE and build so I don't have to be switching between development and for java, intellij is really great,also it would make developing it more normalized in my opinion, and I'm also curious, if it's really easy to do it with Scala and Kotlin there must be a way to do it with Clojure too. – Tzeroxik Nov 04 '17 at 19:00
  • Possibly [this answer](https://stackoverflow.com/questions/2181774/calling-clojure-from-java) could help. For instance, you can call Clojure code dynamically without AOT compilation using RT.var and so on. But nothing found here about convenient integration Clojure + Java within IntelliJ Idea IDE, unfortunately. – Aleksei Sotnikov Nov 05 '17 at 07:58
  • Yeah, I already tried that one... it's so odd they don't have that with clojure, thanks anyway! – Tzeroxik Nov 05 '17 at 11:22
  • Why is that an issue to add one more jar to a project, and call your clj file externally with ` RT.var`? You don't change any structure of the project, you simply add an external dependency which Gradle already handles pretty nicely – Adonis Nov 05 '17 at 19:07
  • See also this answer, although making a JAR file may still be required: https://stackoverflow.com/questions/46436476/how-to-invoke-clojure-function-directly-from-java – Alan Thompson Nov 06 '17 at 19:21
  • I'd prefere to develop the project in the same IDE and it was mostly curiosity, like I said I find it strange that Scala can be set to interop easely with gradle and Clojure can't, I can and I did something like that initially, it was more like a "could I do it better?" kind of scenario, thanks for the help! – Tzeroxik Nov 06 '17 at 21:10

0 Answers0