Just solved it, I really missed something.
I had to replace
java {
sourceSets["main"].java {
"build/generated/sources/srcgen"
}
}
by
java {
sourceSets["main"].java {
srcDir("build/generated/sources/srcgen")
}
}
The change is the srcDir(...)
constructor.
I tried quite long, and just after posting and rereading a topic for the n-th time, I found this detail. I apologize …