We can also use Gradle to work with Scala source files. We can have a Scala-only project, or we can have both Java and Scala source files in our project. We must apply the Scala plugin to enable Scala support for our build. The plugin adds new tasks to compile the Scala source files. With the
compileScala task, we compile our main Scala source files. The source files must be in the
src/main/scala directory. The
compileTestScala task compiles all Scala source code files that are in the
src/test/scala directory. The plugin also adds a
compile<SourceSet>Scala task for custom-defined source sets in our build.
The compile tasks support both Java and Scala source files with joint compilation. We can place our Java source files ...