I've recently upgraded my project to use spring-boot 3.0.0. So I don't have javax.*
modules in the project anymore. But the Open API generator keeps trying to import javax
modules. Especially, it uses javax.annotation.Generated
for the @Generated
annotation which is not present in the project anymore. Is there a way to reconfigure it somehow?
You should follow the documentation whenever possible.
The property that you need is either "useSpringBoot3" or "useJakartaEe"
Go to https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-maven-plugin
At the end of the table you see "configHelp" property which will give you configs for the current generator "spring" in my case
Rerun "mvn clean install" - this will give you a list of available "configOptions".
Read the list and found a property
useJakartaEe: whether to use Jakarta EE namespace instead of javax (Default: false)
My final pom:
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>6.4.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<configHelp>false</configHelp>
<configOptions>
<useJakartaEe>true</useJakartaEe>
</configOptions>
<inputSpec>
${project.basedir}/src/main/resources/api.openapi.yaml
</inputSpec>
<generatorName>spring</generatorName>
<apiPackage>some.package</apiPackage>
<modelPackage>some.package.model</modelPackage>
</configuration>
</execution>
</executions>
</plugin>
Cheers