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-sourc
src/gen/java
You should try the following:
java.sourceSets.create("src/gen/java")
Hope it's what you need!