How to add both src/main and src/test to task jar

I have below gradle task to build the src jar. This wis currently building src/main jar only. How can I force it to make jar with both src/manin and src/test ( basically the folders are as below mentioned in sourceSet intergrationTest )

jar {
 //from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } }
 baseName = 'ce-elasticsearch'
    manifest {
        attributes 'Implementation-Title': 'ElasticSearch Module', 'Implementation-Version': version
  sourceSets {
    integrationTest {
        java.srcDir file('src/test/integration/java')
        resources.srcDir file('src/test/integration/resources')
  task sourcesJar(type: Jar, dependsOn: classes) {
    classifier = 'sources'
    from sourceSets.main.allSource, sourceSets.integrationTest.output
  artifacts {
 archives file: file("build/libs/${project.jar.baseName}-${version}.jar"), name: project.jar.baseName, type: 'jar', builtBy: jar
 archives sourcesJar

afterwards I want another project to compile using only src/main and then testcompile using sourceSet integrationTest.

Thanks for your valuable suggestions.

Add something like ‘from sourceSets.test.allSource’ or ‘from sourceSets.integrationTest.allSource’. ‘from sourceSets.integrationTest.output’ will add class and resource files to the sources Jar.

thanks, will try that