You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I define multiple executions for swagger-maven-plugin-jakarta and it seems that the resourceClasses from the first execution is re-used in all following executions.
All the generated outputs have the same content :-)
<properties>
<api.version>1.20</api.version>
<api.version.new>${api.version}</api.version.new>
<cc.openapi.configuration.new>cc-${api.version.new}-configuration</cc.openapi.configuration.new>
<cc.openapi.history.new>cc-${api.version.new}-history</cc.openapi.history.new>
<cc.openapi.history-analytics.new>cc-${api.version.new}-history-analytics</cc.openapi.history-analytics.new>
<cc.openapi.products.new>cc-${api.version.new}-products</cc.openapi.products.new>
<cc.openapi.brain.new>cc-${api.version.new}-brain</cc.openapi.brain.new>
<cc.openapi.creation-cache.new>cc-${api.version.new}-creation-cache</cc.openapi.creation-cache.new>
<cc.openapi.settings.new>cc-${api.version.new}-settings</cc.openapi.settings.new>
<cc.openapi.vt.new>cc-${api.version.new}-vt</cc.openapi.vt.new>
</properties>
<profiles>
<profile>
<id>generate-api</id>
<build>
<plugins>
<plugin>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-maven-plugin-jakarta</artifactId>
<version>2.2.21</version>
<configuration>
<outputFormat>JSONANDYAML</outputFormat>
<encoding>UTF-8</encoding>
<sortOutput>true</sortOutput>
<prettyPrint>true</prettyPrint>
<readAllResources>false</readAllResources>
<!-- see src/main/resources/META-INF/cc-api-config.yaml - filtered by maven during build with some values from cc top-level pom!-->
<openapiFilePath>${project.build.outputDirectory}/META-INF/cc-api-config.yaml</openapiFilePath>
<openapi31>false</openapi31>
</configuration>
<executions>
<execution>
<id>generate-api-cc-configuration</id>
<goals>
<goal>resolve</goal>
</goals>
<configuration>
<outputPath>${project.basedir}/target/openapi-generated/v${api.version.new}/</outputPath>
<outputFileName>${cc.openapi.configuration.new}</outputFileName>
<!------------------------ this one is used for all following executions ?! ------------------------------------->
<resourceClasses>com.siemens.spice.cc.rest.service.configuration.ConfigurationController</resourceClasses>
</configuration>
</execution>
<execution>
<id>generate-api-cc-configuration-history</id>
<goals>
<goal>resolve</goal>
</goals>
<configuration>
<outputPath>${project.basedir}/target/openapi-generated/v${api.version.new}/</outputPath>
<outputFileName>${cc.openapi.history.new}</outputFileName>
<!------------------------ this one is completely ignored ?! ------------------------------------->
<resourceClasses>com.siemens.spice.cc.rest.api.HistoryControllerApi</resourceClasses>
</configuration>
</execution>
<execution>
<id>generate-api-cc-configuration-history-analytics</id>
<goals>
<goal>resolve</goal>
</goals>
<configuration>
<outputPath>${project.basedir}/target/openapi-generated/v${api.version.new}/</outputPath>
<outputFileName>${cc.openapi.history-analytics.new}</outputFileName>
<!------------------------ this one is completely ignored ?! ------------------------------------->
<resourceClasses>com.siemens.spice.cc.rest.service.history.HistoryAnalyticsController</resourceClasses>
</configuration>
</execution>
<execution>
<id>generate-api-cc-configuration-products</id>
<goals>
<goal>resolve</goal>
</goals>
<configuration>
<outputPath>${project.basedir}/target/openapi-generated/v${api.version.new}/</outputPath>
<outputFileName>${cc.openapi.products.new}</outputFileName>
<!------------------------ this one is completely ignored ?! ------------------------------------->
<resourceClasses>com.siemens.spice.cc.rest.service.products.ProductsController</resourceClasses>
</configuration>
</execution>
<execution>
<id>generate-api-cc-configuration-brain</id>
<goals>
<goal>resolve</goal>
</goals>
<configuration>
<outputPath>${project.basedir}/target/openapi-generated/v${api.version.new}/</outputPath>
<outputFileName>${cc.openapi.brain.new}</outputFileName>
<!------------------------ this one is completely ignored ?! ------------------------------------->
<resourceClasses>com.siemens.spice.cc.rest.api.BrainControllerApi</resourceClasses>
</configuration>
</execution>
<execution>
<id>generate-api-cc-configuration-creation-cache</id>
<goals>
<goal>resolve</goal>
</goals>
<configuration>
<outputPath>${project.basedir}/target/openapi-generated/v${api.version.new}/</outputPath>
<outputFileName>${cc.openapi.creation-cache.new}</outputFileName>
<!------------------------ this one is completely ignored ?! ------------------------------------->
<resourceClasses>com.siemens.spice.cc.rest.service.cache.CreationCacheController</resourceClasses>
</configuration>
</execution>
<execution>
<id>generate-api-cc-configuration-vt</id>
<goals>
<goal>resolve</goal>
</goals>
<configuration>
<outputPath>${project.basedir}/target/openapi-generated/v${api.version.new}/</outputPath>
<outputFileName>${cc.openapi.vt.new}</outputFileName>
<!------------------------ this one is completely ignored ?! ------------------------------------->
<resourceClasses>com.siemens.spice.cc.rest.service.vt.VariantTableController</resourceClasses>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
I found the "problem" :) It has nothing todo with the maven plugin itself and how it read/merge the config. This is all fine. Its all about the "context-id" :-) (Singletons are ugly)
This line in io.swagger.v3.oas.integration.GenericOpenApiContextBuilder is causing the trouble:
If no context-id is given then the maven plugin is using ${project.artifactId} as default. So also in case multiple executions with different settings are expected which results at end in using the same open-api-context again and again.
So its not really a bug or something ... its more a missing hint in the documentation.
I define multiple executions for swagger-maven-plugin-jakarta and it seems that the resourceClasses from the first execution is re-used in all following executions.
All the generated outputs have the same content :-)
May there is a wrong data-handling in the plugin, i,e static variable or something?!
The text was updated successfully, but these errors were encountered: