Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use gradle to develop scala projects?

Tags:

gradle

scala

sbt

I'm using sbt to build scala projects, but it always seems too complex(unfamiliar) and heavy to me. I'm also using gradle to build java projects, and which makes me happy.

I wonder is it possible to use gradle to build scala projects? Is there any big scala projects that uses gradle?

Some of my friends just tell me "Never ever think of using gradle for scala project", but refused to tell me the reason.

like image 451
Freewind Avatar asked May 01 '14 14:05

Freewind


People also ask

Does Gradle work with Scala?

Gradle supports version 1.6. 0 of Zinc and above. The Zinc compiler itself needs a compatible version of scala-library that may be different from the version required by your application. Gradle takes care of specifying a compatible version of scala-library for you.

Which programming language can use Gradle?

It is popular for its ability to build automation in languages like Java, Scala, Android, C/C++, and Groovy. The tool supports groovy based Domain Specific Language over XML. Gradle provides building, testing, and deploying software on several platforms.


2 Answers

It's quite easy to use gradle with Scala. We did it for a long time (team mixed of Java ,Groovy and Scala developers) and have been quite happy with it. Most things work quite well out of the box.

More about gradle with scala: http://www.gradle.org/docs/current/userguide/scala_plugin.html

There are some problems/downfalls though:

  • Mixed code compilation when depending on Scala Code from Java in Mixed Code projects. (Some configuration and it will work, but not out of the box)
  • more configuration for Scala specific tools needed as in sbt
  • Integration of some Scala-Tools like the Scalastyle or scct is not possible yet
  • no sbt console (gradle console has not been working properly since the last time I checked)
  • adding the scala_version number to artifacts has to be added manually each time (no %% as in sbt)
like image 198
Andreas Neumann Avatar answered Sep 19 '22 19:09

Andreas Neumann


It's definitely possible. Gradle's Scala support is documented in the "Scala plugin" chapter in the Gradle User Guide. The plugin is used by big companies on big projects, and can be configured to use the same incremental Scala compiler as sbt. So best try for yourself and see if it fits your requirements.

like image 32
Peter Niederwieser Avatar answered Sep 21 '22 19:09

Peter Niederwieser