api / org.gradle.api.plugins / JavaPluginConvention / sourceSets

sourceSets

open fun sourceSets(closure: Closure<Any>): Any

Configures the source sets of this project.

The given closure is executed to configure the SourceSetContainer. The SourceSetContainer is passed to the closure as its delegate.

See the example below how org.gradle.api.tasks.SourceSet 'main' is accessed and how the org.gradle.api.file.SourceDirectorySet 'java' is configured to exclude some package from compilation.

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

Parameters

closure - The closure to execute.

Return
NamedDomainObjectContainer<org.gradle.api.tasks.SourceSet>