sourceSets

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

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.

plugins {
    id 'java'
}

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

Return

NamedDomainObjectContainer

Since

7.1

Parameters

closure

The closure to execute.