API Documentation: | SourceSet |
---|
A SourceSet
represents a logical group of Java source and resources.
See the example below how SourceSet
'main' is accessed and how the SourceDirectorySet
'java'
is configured to exclude some package from compilation.
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. |
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. |
SourceDirectorySet
allJava
(read-only)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.
java
plugin:[java]
SourceDirectorySet
allSource
(read-only)All source files for this source set.
java
plugin:[java, resources]
FileCollection
compileClasspath
The classpath used to compile this source.
java
plugin:project.configurations.compile
(or project.configurations.testCompile
for the test
source set).SourceDirectorySet
java
(read-only)The Java source which is to be compiled by the Java compiler into the class output directory.
java
plugin:[${project.projectDir}
/src/${sourceSet.name}
/java]
String
name
(read-only)The name of this source set.
SourceSetOutput
output
(read-only)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
java
plugin:SourceSetOutput
SourceDirectorySet
resources
(read-only)The non-Java resources which are to be copied into the resources output directory.
java
plugin:[${project.projectDir}
/src/${sourceSet.name}
/resources]
FileCollection
runtimeClasspath
The classpath used to execute this source.
java
plugin:sourceSet.output + project.configurations.runtime
(or sourceSet.output + project.configurations.testRuntime
for the test
source set).SourceDirectorySet
antlr
(read-only)All Antlr source for this source set.
SourceDirectorySet
allGroovy
(read-only)All Groovy source for this source set.
SourceDirectorySet
groovy
(read-only)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.
SourceDirectorySet
allScala
(read-only)All Scala source for this source set.
SourceDirectorySet
scala
(read-only)The source to be compiled by the Scala compiler for this source set. This may contain both Java and Scala source files.
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. |
Configures the Java source for this set.
The given closure is used to configure the SourceDirectorySet
which contains the Java source.
SourceDirectorySet
from java
Configures the non-Java resources for this set.
The given closure is used to configure the SourceDirectorySet
which contains the resources.
SourceDirectorySet
from resources
Configures the Antlr source for this set. The given closure is used to configure the SourceDirectorySet
(see
AntlrSourceVirtualDirectory.getAntlr()
) which contains the Antlr source.
SourceDirectorySet
from antlr
Configures the Groovy source for this set.
The given closure is used to configure the SourceDirectorySet
which contains the Groovy source.
SourceDirectorySet
from groovy
Configures the Scala source for this set.
The given closure is used to configure the SourceDirectorySet
which contains the Scala source.
SourceDirectorySet
from scala
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. |
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()
.