How to use gradle with generated sources?

I finally fix mine problem but with the need to put some extra information from user side (arf …)

user need to put this piece of code:

sourceSets {
   generated{
        java.srcDir "${buildDir}/generated/src/java/"
    }
}

compileGeneratedJava{
    dependsOn(hbm2dao)
    classpath = configurations.compile
}
compileJava{
    dependsOn(compileGeneratedJava)
    source    += sourceSets.generated.java
}

I do not know how to override user sourceset once my plugin is applied to avoid to put any extra information user side.
That could to be really cool to send automatically the sourcesets when the user call the target compileJava. They are any documentation about this or easy way to do it …

So in this current state I publish a first stable release of mine plugin: https://github.com/institut-de-genomique/hibernatetools-gradle-plugin/releases