is it somehow possible to define the info.version
attribute in openapi.yaml as a placeholder and to replace this placeholder with each maven build by the maven artifact version?
Thanks in advance. Kind regards
The maven replacer plugin might be one solution. For me it's working well.
openapi.yaml
...
info:
version: OPENAPI_VERSION_REPLACER # version of this interface specification is set during build
...
Maven profiles/profile/build/plugins/
<plugin>
<artifactId>maven-replacer-plugin</artifactId>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<version>${maven-replacer-plugin.version}</version>
<executions>
<execution>
<id>api-spec-path-replacement</id>
<phase>none</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<basedir>${project.build.outputDirectory}/openapi</basedir>
<includes>
<include>**/*.yaml</include>
</includes>
<replacements>
<replacement>
<token>version:.*OPENAPI_VERSION_REPLACER.*#</token>
<value>version: ${project.version} # Automatically set by maven replacer plugin -
</value>
</replacement>
</replacements>
</configuration>
</plugin>