Movatterモバイル変換


[0]ホーム

URL:


SourceSet

Table of Contents

Properties
Methods
Script blocks
Property details
Method details
Script block details
API Documentation:SourceSet

ASourceSet represents a logical group of Java source and resources.

See the example below howSourceSet 'main' is accessed and how theSourceDirectorySet 'java'is configured to exclude some package from compilation.

apply plugin:'java'sourceSets {  main {    java {      exclude'some/unwanted/package/**'    }  }}

Properties

PropertyDescription
allJava

All Java source files for this source set. This includes, for example, source which is directly compiled, andsource 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

SourceSetOutput is aFileCollection 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 inSourceSetOutput

resources

The non-Java resources which are to be copied into the resources output directory.

runtimeClasspath

The classpath used to execute this source.

Properties added by theantlr plugin

PropertyDescription
antlr

All Antlr source for this source set.

Properties added by thegroovy plugin

PropertyDescription
allGroovy

All Groovy source for this source set.

groovy

The source to be compiled by the Groovy compiler for this source set. Any Java source present in this setwill be passed to the Groovy compiler for joint compilation.

Properties added by thescala plugin

PropertyDescription
allScala

All Scala source for this source set.

scala

The source to be compiled by the Scala compiler for this source set. This may contain both Java and Scalasource files.

Methods

MethodDescription
compiledBy(taskPaths)

Registers a set of tasks which are responsible for compiling this source set into the classes directory. Thepaths are evaluated as perTask.dependsOn(java.lang.Object[]).

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.

Methods added by theantlr plugin

MethodDescription
antlr(configureAction)

Configures the Antlr source for this set. The given action is used to configure theSourceDirectorySet (seeAntlrSourceVirtualDirectory.getAntlr()) which contains the Antlr source.

Methods added by thegroovy plugin

MethodDescription
groovy(configureAction)

Configures the Groovy source for this set.

Methods added by thescala plugin

MethodDescription
scala(configureAction)

Configures the Scala source for this set.

Script blocks

BlockDescription
java

Configures the Java source for this set.

resources

Configures the non-Java resources for this set.

Script blocks added by theantlr plugin

BlockDescription
antlr

Configures the Antlr source for this set. The given closure is used to configure theSourceDirectorySet (seeAntlrSourceVirtualDirectory.getAntlr()) which contains the Antlr source.

Script blocks added by thegroovy plugin

BlockDescription
groovy

Configures the Groovy source for this set.

Script blocks added by thescala plugin

BlockDescription
scala

Configures the Scala source for this set.

Property details

SourceDirectorySetallJava (read-only)

All Java source files for this source set. This includes, for example, source which is directly compiled, andsource which is indirectly compiled through joint compilation.

Default withjava plugin:
[java]

SourceDirectorySetallSource (read-only)

All source files for this source set.

Default withjava plugin:
[java, resources]

FileCollectioncompileClasspath

The classpath used to compile this source.

Default withjava plugin:
project.configurations.compileClasspath (orproject.configurations.testCompileClasspath for thetest source set).

SourceDirectorySetjava (read-only)

The Java source which is to be compiled by the Java compiler into the class output directory.

Default withjava plugin:
[${project.projectDir}/src/${sourceSet.name}/java]

Stringname (read-only)

The name of this source set.

SourceSetOutputoutput (read-only)

SourceSetOutput is aFileCollection 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 inSourceSetOutput

Default withjava plugin:
SeeSourceSetOutput

SourceDirectorySetresources (read-only)

The non-Java resources which are to be copied into the resources output directory.

Default withjava plugin:
[${project.projectDir}/src/${sourceSet.name}/resources]

FileCollectionruntimeClasspath

The classpath used to execute this source.

Default withjava plugin:
sourceSet.output + project.configurations.runtime (orsourceSet.output + project.configurations.testRuntime for thetest source set).

SourceDirectorySetantlr (read-only)

All Antlr source for this source set.

SourceDirectorySetallGroovy (read-only)

All Groovy source for this source set.

SourceDirectorySetgroovy (read-only)

The source to be compiled by the Groovy compiler for this source set. Any Java source present in this setwill be passed to the Groovy compiler for joint compilation.

SourceDirectorySetallScala (read-only)

All Scala source for this source set.

SourceDirectorySetscala (read-only)

The source to be compiled by the Scala compiler for this source set. This may contain both Java and Scalasource files.

Method details

SourceSetcompiledBy(Object... taskPaths)

Registers a set of tasks which are responsible for compiling this source set into the classes directory. Thepaths are evaluated as perTask.dependsOn(java.lang.Object[]).

StringgetCompileTaskName(String language)

Returns the name of a compile task for this source set.

StringgetTaskName(String verb,String target)

Returns the name of a task for this source set.

SourceSetjava(Action<? superSourceDirectorySet> configureAction)

Configures the Java source for this set.

The given action is used to configure theSourceDirectorySet which contains the Java source.

SourceSetresources(Action<? superSourceDirectorySet> configureAction)

Configures the non-Java resources for this set.

The given action is used to configure theSourceDirectorySet which contains the resources.

Configures the Antlr source for this set. The given action is used to configure theSourceDirectorySet (seeAntlrSourceVirtualDirectory.getAntlr()) which contains the Antlr source.

GroovySourceSetgroovy(Action<? superSourceDirectorySet> configureAction)

Configures the Groovy source for this set.

The given action is used to configure theSourceDirectorySet which contains the Groovy source.

ScalaSourceSetscala(Action<? superSourceDirectorySet> configureAction)

Configures the Scala source for this set.

The given action is used to configure theSourceDirectorySet which contains the Scala source.

Script block details

java { }

Configures the Java source for this set.

The given closure is used to configure theSourceDirectorySet which contains the Java source.

Delegates to:
SourceDirectorySet fromjava

resources { }

Configures the non-Java resources for this set.

The given closure is used to configure theSourceDirectorySet which contains the resources.

Delegates to:
SourceDirectorySet fromresources

antlr { }

Configures the Antlr source for this set. The given closure is used to configure theSourceDirectorySet (seeAntlrSourceVirtualDirectory.getAntlr()) which contains the Antlr source.

Delegates to:
SourceDirectorySet fromantlr

groovy { }

Configures the Groovy source for this set.

The given closure is used to configure theSourceDirectorySet which contains the Groovy source.

Delegates to:
SourceDirectorySet fromgroovy

scala { }

Configures the Scala source for this set.

The given closure is used to configure theSourceDirectorySet which contains the Scala source.

Delegates to:
SourceDirectorySet fromscala

[8]ページ先頭

©2009-2025 Movatter.jp