concept Scala plugin in category gradle

appears as: Scala plugin, The Scala plugin, Scala plugin
Gradle in Action - corrected 9052019

This is an excerpt from Manning's book Gradle in Action - corrected 9052019.

The Scala plugin internally applies not only the Scala base plugin, but also the Java plugin. This allows you to build Java and Scala source code within a single project. The feature the Scala plugin provides on top of the Scala base plugin is the ability to generate HTML API documentation for Scala source code. If you’re building a full-fledged Scala project, applying the Scala plugin is your best choice. Let’s see Scala in action.

To demonstrate the use of Scala within your To Do application, you’ll convert a Java class into a Scala class. The project in your build with the least complex source code is the model project. At the moment, this project’s build.gradle file doesn’t define any logic. The following listing applies the Scala plugin and declares the Scala library to get a hold on the Scala compiler.

Listing 11.19. Using Scala to manage production source code

After applying the Scala plugin, your project can compile any Scala source code found in the directories src/main/scala and src/test/scala. Figure 11.6 shows the groovy source set directories alongside the source directory conventions introduced by the Java plugin.

Figure 11.6. Default source directories for projects applying the Scala plugin