# sourceSets

abstract fun sourceSets(closure: Closure): Any(source)

Configures the source sets of this project.

#### Return

NamedDomainObjectContainer

#### Since

7.1

#### Parameters

closure

The closure to execute.

#### See also

sourceSets(Action)

@Incubating
abstract fun sourceSets(action: Action<in SourceSetContainer>)(source)

Configures the source sets of this project.

The given action is executed to configure the SourceSetContainer.

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.

    plugins {
        id 'java'
    }

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

Content copied to clipboard

#### Since

9.3.0

#### Parameters

action

the configuration action