SourceSet is being ignored

Hi!
I got a jar task and a custom sourceSet, it currently looks like this:

sourceSets.create("tmpSet") {
    java {
        srcDir("build/tmp/ss-src/java")
        srcDir("build/tmp/ss-src/kotlin")
    }
    resources {
        srcDir("build/tmp/ss-src/resources")
    }
}

tasks.create("JarTaskTest", Jar::class) {
    duplicatesStrategy = DuplicatesStrategy.INCLUDE
    manifest { attributes["Main-Class"] = ssMain }
    dependsOn(configurations.runtimeClasspath)
    from({
        sourceSets["tmpSet"].output
        configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
    })
}

It builds the jar, packs all the libraries into it but none of the directories mentioned in the SourceSet.
They do exist and all, doesnt throw any errors either.
Im running it from IntelliJ on the right side via others > JarTaskTest
What am i missing? thankful for any help

It doesn’t look like you’re actually including the output of the sourceSet in the JAR. The argument passed to from is a lambda, not a collection, so when the lambda executes, only the last line is returned.

I see, thank you, how would i go about that exactly?
In all guides i saw these are the only steps people took, when i still used the main sourceSet all i had to do too was include the main output.
Id love some guidance here, im pretty lost

I think you’ve combined two things that should not be combined from different guides. The from right now has one lambda as the argument. The lambda only returns the last line to the from. Therefore, it is like the sourceSets["tmpSet"].output isn’t even there. The lambda would be there for the runtimeClasspath to not evaluate it too early in older Gradle examples. You can change that to use the lazier APIs, but the smallest change to get what you expect from the above would just be splitting the output to its own from:

from(sourceSets["tmpSet"].output)
from({ configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) } })

Thats it, thank you!