But it might anyway be a better idea to generate these files as resources, not as compilation result.
For example by having them in src/main/resources with placeholders and using expand on the processResources task to fill in the placeholders.
This is about managing resources: Building Java & JVM projects
which also links to Working With Files which describes some of the possibilities you have also for the processResources task like for example using expand.