Another thing to consider: You could split your generate task into two tasks.
The first task (in each subproject) uses the complied classes to generate an xml/json file with all the annotation info.
The second task (in the service project) iterates all of the xml/json files and generates the kotlin (and subsequently compiles it)