| API Documentation: | SourceSet |
|---|
A SourceSet represents a logical group of Java source and resource files. They
are covered in more detail in the
user manual.
The following example shows how you can configure the 'main' source set, which in this
case involves excluding classes whose package begins 'some.unwatned.package' from
compilation of the source files in the 'java' SourceDirectorySet:
apply plugin: 'java' sourceSets { main { java { exclude 'some/unwanted/package/**' } } }
| Property | Description |
allJava | All Java source files for this source set. This includes, for example, source which is directly compiled, and source which is indirectly compiled through joint compilation. |
allSource | All source files for this source set. |
compileClasspath | The classpath used to compile this source. |
extensions | The container of extensions. |
java | The Java source which is to be compiled by the Java compiler into the class output directory. |
name | The name of this source set. |
output |
|
resources | The non-Java resources which are to be copied into the resources output directory. |
runtimeClasspath | The classpath used to execute this source. |
| Property | Description |
antlr | All Antlr source for this source set. |
| Method | Description |
compiledBy(taskPaths) | Registers a set of tasks which are responsible for compiling this source set into the classes directory. The
paths are evaluated as per |
getCompileTaskName(language) | Returns the name of a compile task for this source set. |
getTaskName(verb, target) | Returns the name of a task for this source set. |
java(configureAction) | Configures the Java source for this set. |
resources(configureAction) | Configures the non-Java resources for this set. |
| Method | Description |
antlr(configureAction) | Configures the Antlr source for this set. The given action is used to configure the |
| Method | Description |
groovy(configureAction) | Configures the Groovy source for this set. |
| Method | Description |
scala(configureAction) | Configures the Scala source for this set. |
| Block | Description |
antlr | Configures the Antlr source for this set. The given closure is used to configure the |
| Block | Description |
groovy | Configures the Groovy source for this set. |
| Block | Description |
scala | Configures the Scala source for this set. |
All Java source files for this source set. This includes, for example, source which is directly compiled, and source which is indirectly compiled through joint compilation.
- Default with
javaplugin: [java]
All source files for this source set.
- Default with
javaplugin: [java, resources]
The classpath used to compile this source.
- Default with
javaplugin: project.configurations.compileClasspath(orproject.configurations.testCompileClasspathfor thetestsource set).
The container of extensions.
The Java source which is to be compiled by the Java compiler into the class output directory.
- Default with
javaplugin: [${project.projectDir}/src/${sourceSet.name}/java]
The name of this source set.
SourceSetOutput is a FileCollection of all output directories (compiled classes, processed resources, etc.)
and it provides means to configure the default output dirs and register additional output dirs. See examples in SourceSetOutput
- Default with
javaplugin: - See
SourceSetOutput
The non-Java resources which are to be copied into the resources output directory.
- Default with
javaplugin: [${project.projectDir}/src/${sourceSet.name}/resources]
The classpath used to execute this source.
- Default with
javaplugin: sourceSet.output + project.configurations.runtime(orsourceSet.output + project.configurations.testRuntimefor thetestsource set).
All Antlr source for this source set.
All Groovy source for this source set.
The source to be compiled by the Groovy compiler for this source set. Any Java source present in this set will be passed to the Groovy compiler for joint compilation.
All Scala source for this source set.
The source to be compiled by the Scala compiler for this source set. This may contain both Java and Scala source files.
Registers a set of tasks which are responsible for compiling this source set into the classes directory. The
paths are evaluated as per Task.dependsOn(java.lang.Object[]).
Configures the Java source for this set.
The given action is used to configure the SourceDirectorySet which contains the Java source.
Configures the non-Java resources for this set.
The given action is used to configure the SourceDirectorySet which contains the resources.
Configures the Antlr source for this set. The given action is used to configure the SourceDirectorySet (see
AntlrSourceVirtualDirectory.getAntlr()) which contains the Antlr source.
Configures the Groovy source for this set.
The given action is used to configure the SourceDirectorySet which contains the Groovy source.
Configures the Scala source for this set.
The given action is used to configure the SourceDirectorySet which contains the Scala source.
Configures the Java source for this set.
The given closure is used to configure the SourceDirectorySet which contains the Java source.
- Delegates to:
SourceDirectorySetfromjava
Configures the non-Java resources for this set.
The given closure is used to configure the SourceDirectorySet which contains the resources.
- Delegates to:
SourceDirectorySetfromresources
Configures the Antlr source for this set. The given closure is used to configure the SourceDirectorySet (see
AntlrSourceVirtualDirectory.getAntlr()) which contains the Antlr source.
- Delegates to:
SourceDirectorySetfromantlr
Configures the Groovy source for this set.
The given closure is used to configure the SourceDirectorySet which contains the Groovy source.
- Delegates to:
SourceDirectorySetfromgroovy
Configures the Scala source for this set.
The given closure is used to configure the SourceDirectorySet which contains the Scala source.
- Delegates to:
SourceDirectorySetfromscala