Depending on how you want the generated source files to be compiled, the solution may be as simple as adding the source files to the main
source set:
sourceSets.main.java.srcDir "build/generated-files" // adapt as necessary
Additionally, compileJava
will need to depend on the task that generates the sources.