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


(Ulf Gitschthaler) #1

Hi,

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.

Greetings,

Ulf


(Peter Niederwieser) #2

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.


(Ulf Gitschthaler) #3

Thx for your answer!


(Andrei Pozolotin) #4

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.


(Peter Niederwieser) #5

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).


(Andrei Pozolotin) #6

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


(Peter Niederwieser) #7

Yes it will, even in the free community edition.


(Andrei Pozolotin) #8

got it, thank you.


(Peter Niederwieser) #9

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


(Andrei Pozolotin) #10

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