This Swagger plugin does support incremental builds without your additions to GenerateSwaggerCode
.
However, you will likely have problems with the configuration in your example given that the destination is the same for both generateSwaggerCodeJaxrsClient
and generateSwaggerCodeJaxrsServer
task. This is generally not preferred, but even worse in this case because there’s logic in the plugin to delete the outputDir
by default if the task runs.
Therefore, generateSwaggerCodeJaxrsClient
deletes the directory and executes, then generateSwaggerCodeJaxrsServer
deletes the directory and executes. You should be able to remove
tasks.withType(GenerateSwaggerCode) {
inputs.file('path/to/spec.yaml')
outputs.dir('build/generated/sources/swagger')
}
and run just one task at a time ( generateSwaggerCodeJaxrsClient
or generateSwaggerCodeJaxrsServer
) to see the incremental behavior. You’ll need to change your actual configuration to use this for real though.