Cross build scala using gradle

gradle, scala

Solution

Gradle's Scala plugin doesn't currently support cross-building. It's possible to implement it yourself, though. In my Polyglot Gradle talk, I presented a proof-of-concept.

Problem

I've got a Scala project that is built with Gradle. The Scala code is source compatible with scala 2.9 and 2.10 and I'd like to cross build it to both major Scala versions. Does Gradle support this? For example, my gradle project will have a single module: ``` build.gradle src/main/scala/foo.scala ``` and I'd like the resulting published jars to be: ``` org-foo_2.9-0.1.jar (with dependency on scala-library 2.9) org-foo_2.10-0.1.jar (with dependency on scala-library 2.10) ```

Original source