Working with source sets

The Java plugin also adds a new concept to our project—source sets. A source set is a collection of source files that are compiled and executed together. The files can be Java source files or resource files. Source sets can be used to group together files with a certain meaning in our project, without having to create a separate project. For example, we can separate the location of source files that describe the API of our Java project in a source set, and run tasks that only apply to the files in this source set.

Without any configuration, we already have the main and test source sets, which are added by the Java plugin. For each source set, the plugin also adds these three tasks: compile<SourceSet>Java, process<SourceSet>Resources ...

The best content for your career. Discover unlimited learning
on demand for around $1/day.