How to use gradle with generated sources?

yes is exactly I just done (I think), I updated result in the first post.
I do:

compileGeneratedJava.dependsOn(hbm2dao)
compileJava.dependsOn(compileGeneratedJava)
compileJava.source sourceSets.generated.java, sourceSets.main.java

It seem dependencies is not apply to generated class

If I do instead this:

compileJava{
    dependsOn hbm2dao
    source sourceSets.generated.output
}

Less error …

src/main/java/fr/cea/ig/wildfly/App.java:35: error: package fr.cea.ig.database.pkgdb.dao does not exist
import fr.cea.ig.database.pkgdb.dao.GenomicObjectHome;
                                   ^
src/main/java/fr/cea/ig/wildfly/App.java:40: error: cannot find symbol
    GenomicObjectHome genomicObjectHome;
    ^
  symbol:   class GenomicObjectHome
  location: class App
2 errors
1 warning
:compileJava FAILED

While the class exists:

$ ls build/generated/fr/cea/ig/database/pkgdb/dao/
GenomicObjectHome.java  GoProcessHome.java  GoReactionHome.java  OrganismHome.java

thanks for your help