Gradle - SourceSets

About

A SourceSet represents a logical group of Java source and resource files.

Example

apply plugin: 'java'

Exclude

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

Set

sourceSets {
    main {
         java {
            srcDirs = ['src']
         }
    }

    test {
        java {
            srcDirs = ['test']
        }
    }
}

Add a path to the actual sourceSets

sourceSets {
    main {
        java {
            srcDir 'thirdParty/src/main/java'
        }
    }
}

or

sourceSets {
    main {
        java {
            srcDirs += 'thirdParty/src/main/java'
        }
    }
}

Documentation


Powered by ComboStrap