How to add new sourceset with gradle kotlin-dsl
I want to add a sourceset src/gen/java . With groovy this is rather easy and already described in https://discuss.gradle.org/t/how-to-use-gradle-with-generated-sources/9401/5 sourceSets { gen { java.srcDir "src/gen/java" } } But I stuck with the kotlin-dsl to add a new one. All I've got is: java { sourceSets { } } Can anyone help here to You should try the following: java.sourceSets.create("src/gen/java") Hope it's what you need! The answer of @s1m0nw1 is correct to add a new sourceset. But to just add a new source-folder in an existing sourceset, this can be used: java.sourceSets["main"].java