我使用来自kongchen的swagger-maven-plugin。另外,我使用maven-release-plugin。从swagger-maven- swagger.json生成的插件不是repo的一部分。如果我使用mvn包构建应用程序,则会生成swagger.json,并将其作为jar的一部分。
如果我使用maven- release - swagger.json发布应用程序,那么插件不是jar文件的一部分。我查看了日志,发现maven-release-plugin有三个步骤--release:清理,release:准备和执行。
发布:清理-清理工作空间
发布:prepare- logs显示swagger-maven-plugin可以工作并生成swagger.json
release:perform logs显示perform由三个阶段组成(verify-completed-prepare-阶段、checkout-prjoect-from-scm和run-perform-goals)。我认为这意味着整个项目被再次签出,因此生成的文件消失了(这是多么好啊……)。
我如何添加另一个阶段来发布:执行?
我找到了以下文档https://maven.apache.org/maven-release/maven-release-manager/index.html,并且知道可以添加额外的准备目标https://maven.apache.org/maven-release/maven-release-plugin/examples/run-goals-before-commit.html
我需要将目标添加到发布:执行步骤(例如,编译或打包)。我怎样才能做到这一点呢?
谢谢!
<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>发布于 2021-04-23 02:07:21
需要设置release:perform的goals参数。它包含了在“内部构建”中执行的目标。
https://stackoverflow.com/questions/67218029
复制相似问题