I use the swagger-maven-plugin from kongchen. Additionally I use the maven-release-plugin. The swagger.json which is generated from swagger-maven-plugin is not part of the repo. If I build the application with mvn package the swagger.json is generated and part of the jar.
If I release the app with maven-release-plugin the swagger.json is not part of the jar-file. I checked the logs and saw that maven-release-plugin has three steps - release:clean, release:prepare and perform.
release:clean - cleans the workspace
release:prepare - logs show that the swagger-maven-plugin works and generated the swagger.json
release:perform - logs show that perform is composed of three phases (verify-completed-prepare-phases, checkout-prjoect-from-scm and run-perform-goals). I think this means that the whole project is checked out again and therefore the generated file is gone (how great is that...).
How can I add another phase to release:perform?
I found the following documentation https://maven.apache.org/maven-release/maven-release-manager/index.html and know that additional preparation goals can be added https://maven.apache.org/maven-release/maven-release-plugin/examples/run-goals-before-commit.html
I need to add goals to the release:perform step (for example compile or package). How can I achieve that?
Thanks!
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>3.1.8</version>
<configuration>
<apiSources>
<apiSource>
<basePath>/.../api</basePath>
<locations>
<location>not.public</location>
</locations>
<info>
<title>${project.artifactId}</title>
<version>${project.version}</version>
</info>
<outputFormats>json</outputFormats>
<swaggerDirectory>${basedir}/src/main/resources/META-INF/path</swaggerDirectory>
</apiSource>
</apiSources>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
target/generated-sources
... And the checkout during the release is intended to checkout only the code which is got from the tagged state (git tag...) before... which will fail because the build will change source locations and is not checked in correctly... – khmarbaisetarget/...
- can I still serve the file via http-requests? The application is a quarkus-service which uses swagger-ui. And the ui needs that swagger-file. – Hamburmltarget/...
it's still not in the jar because the swagger-maven-plugin is not executed duringrelease:perform
– Hamburml