How to setup project to support different languages (java, clojure, groovy, scala etc.)?


As mentioned in a previous post, I am currently working on Clojure support for one of my projects. This project consists of some common code katas and is setup to use Java for the “main” code (src/main/java) and Spock for the test code (src/test/groovy).

The basic approach to add clojure to this project worked but I was not able to test the Clojure code…

Is there a way to test my clojure code katas with Spock or do I have to get back to some Clojure testing framework and wire it up with JUnit?

Please also state if you have a different idea how to setup this project. My main idea was to support different languages on the JVM (Java, Clojure, maybe Scala etc.) to solve the different code katas without separating the languages on different modules.

Thanks for any hints/recommendations in advance.



For the JVM languages that Gradle supports out-of-the-box (Java/Groovy/Scala), there is no setup involved other than applying the plugins and putting the classes into the correct per-language source directories. I’d expect the same to be true for Clojure, but know too little about the Clojuresque plugin (which I suppose you are using). It might simply be a matter of if/how the Clojure code can be used from Groovy. For lower-level tests which test code written in a language other than Java, it usually pays off to write the tests in the same language.

Thx for your answer!

hi. I can not find a way to setup java + groovy + scala project in eclipse.

activating “apply plugin : scala” kills eclipse groovy plugin.

an fixing groovy plugin (via gradle -> refresh) kills scala plugin in eclipse.

both groovy and scala eclipse plugins seems are trying to install competing patches to JDT.

is there a working project example somewhere please?

thank you.

As far as I know, the Eclipse Groovy and Eclipse Scala plugins are incompatible. It definitely used to be this way. You may have to use two separate Eclipse installations (or switch to IntelliJ IDEA).

you mean (java + scala + groovy) will work in idea?

Yes it will, even in the free community edition.

got it, thank you.

By the way, I’m talking about separate IDEA modules here. I’ve never tried mixing all three languages in the same module.

I see. I guess I am pushing the envelop too much :slight_smile: