Reputation: 345
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>
Upvotes: 0
Views: 1672
Reputation: 35795
You need to set the goals
parameter of release:perform
. This contains the goals that are executed in the "inner build".
Upvotes: 1