2

I added the openapi-generator-maven-plugin to my project. Then I saw that by adding two executions in the pom file, I could split api yaml specs into multiple smaller files. This works fine during the generate sources phase, but in the repackage phase the maven build fails because there are also two separate 'OpenApiGeneratorApplication' classes generated. (repackage failed: Unable to find a single main class).

I usually tend to write my own Application class, so I wouldn't mind if they would not be created at all. From what I know, this is only possible by setting the 'generateApis' config param of the plugin to false. But of course then all the *Api, *Controller, *Delegate classes also don't get generated.

I'd like to be able to split my endpoint methods (and schemas) by business type into separate yaml specs. Usually I'd make different projects all together, but in this case I'm not allowed to do so.

Is this achievable without customizing the OpenAPI Code Generator?

Thanks, kopi

bernd
  • 41
  • 2
  • did you manage to find a way to resolve this ? I'm having the same issue. – stackMan10 Jul 03 '23 at 15:16
  • i found a way to get what i want, but it's not based on anything that the generator project does. i'm using the maven-assembly-plugin to generate a separate assembly of the same artifact. in the assembly descriptor i'm excluding all the files i write on my own, e.g. the application class and reference that assembly in my application artifact/module. it works, but i would much happier if the generator would allow a more precise configuration. tell me if this alternative is an option for you, then i might post a longer answer later on... – bernd Jul 04 '23 at 21:56

1 Answers1

0

You can prevent the OpenApiGeneratorApplication classes from being generated as described here, i.e. by adding "**/OpenApiGeneratorApplication.java" to .openapi-generator-ignore.

gebi
  • 585
  • 4
  • 11