Create project and JAR from files generated by annotation processor

Hi everyone,

I started to work on an annotation processor which generates HTTP client implementations from Spring MVC controllers. However, I now have a problem : I would like to be able to create a gradle project from the generated files, that I can use as a dependency in other projects. For instance, let’s say I have the project ‘server’ with the Spring controllers (i.e. the project which runs the annotation processor and generate the sources when built) and the project ‘client’ which needs to call endpoints to server using the generated HTTP client. I would like to generate a project ‘server-client’ with the HTTP client implementation to use it in my ‘client’ project. The build files would look something like :

// server/build.gradle (project 'server')
dependencies {
    compileOnly(':my-processor')
    kapt(':my-processor') // Doing it in Kotlin :)
}

// client/build.gradle (project 'client')
dependencies {
    compile(':server-client') // project whose sources are the files generated by the annotation processor 
}

Is it possible to have that kind of “virtual” project which consists of generated sources ?

Thanks a lot !
Jordan