swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
16.98k stars 6.03k forks source link

Automatic build-on-change in Eclipse for swagger-codegen-maven-plugin #5665

Open avendasora opened 7 years ago

avendasora commented 7 years ago
Description

Have swagger-codegen-maven-plugin automatically generate whenever the inputSpec or any file in the templateDirectory templates is modified.

Swagger-codegen version

2.2.3-SNAPSHOT

Related issues

https://github.com/swagger-api/swagger-codegen/issues/4758

Suggested Solution

https://github.com/avendasora/swagger-codegen/commit/09b7a5a6b76c5886689a64a10fa7318dd43411eb

I will create a Pull Request if this seems like a reasonable solution.

avendasora commented 7 years ago

My bad - The suggested fix causes an endless-build loop.

i.e. on build, swagger-codegen-maven-plugin executes the generate goal which modifies project files (kinda the point), which causes another build, which causes the generate goal to execute, which causes a build, which causes the generate goal to execute, which causes a build, and so on, ad infinitum.

I thought that the fix avoided that problem, but it does not. I believe avoiding the endless-build loop problem may require changes to the io.swagger.codegen.CodegenConfig interface, which could have far greater impact.