Movatterモバイル変換


[0]ホーム

URL:


SourceSet

API Documentation:SourceSet

ASourceSet represents a logical group of Java source and resource files. Theyare covered in more detail in theuser manual.

The following example shows how you can configure the 'main' source set, which in thiscase involves excluding classes whose package begins 'some.unwanted.package' fromcompilation of the source files in the 'java'SourceDirectorySet:

plugins {    id'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.

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

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

TheAntlrSourceDirectorySet added by the antlr plugin.

Properties added by thegroovy plugin

PropertyDescription
groovy

TheGroovySourceDirectorySet added by the groovy plugin.

Properties added by thescala plugin

PropertyDescription
scala

TheScalaSourceDirectorySet added by the scala plugin.

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.

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 theAntlrSourceDirectorySet added by the antlr plugin.

Script blocks added by thegroovy plugin

BlockDescription
groovy

Configures theGroovySourceDirectorySet added by the groovy plugin.

Script blocks added by thescala plugin

BlockDescription
scala

Configures theScalaSourceDirectorySet added by the scala plugin.

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).

ExtensionContainerextensions (read-only)

The container of extensions.

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.runtimeClasspath (orsourceSet.output + project.configurations.testRuntimeClasspath for thetest source set).

AntlrSourceDirectorySetantlr (read-only)

TheAntlrSourceDirectorySet added by the antlr plugin.

GroovySourceDirectorySetgroovy (read-only)

TheGroovySourceDirectorySet added by the groovy plugin.

ScalaSourceDirectorySetscala (read-only)

TheScalaSourceDirectorySet added by the scala plugin.

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.

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 theAntlrSourceDirectorySet added by the antlr plugin.

groovy { }

Configures theGroovySourceDirectorySet added by the groovy plugin.

scala { }

Configures theScalaSourceDirectorySet added by the scala plugin.

©Gradle Inc. All rights reserved.
gradle
Careers |Privacy |Terms of Service |Contact

[8]ページ先頭

©2009-2025 Movatter.jp