我使用springdoc-openapi-maven-plugin在mvn clean install命令期间生成document_name.json文件,具有以下插件配置:
<plugin>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-maven-plugin</artifactId>
<version>0.2</version>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<outputFileName>sentinel-openapi.json</outputFileName>
<outputDir>${project.build.directory/../../openapi-doc/}</outputDir>
</configuration>
</plugin>
此外,我还使用spring-boot-maven-plugin
在集成测试期间启动和停止应用程序:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
但是,我需要使用./mvnw package
命令生成相同的document_name.json
文件。如何配置springdoc-openapi-maven-plugin
和spring-boot-maven-plugin
以实现此目标?
1条答案
按热度按时间6rqinv9w1#
默认情况下,springdoc-openapi-maven-plugin在端口8080中生成API文档(假设应用程序在8080上运行),如果应用程序运行的端口不同,则必须在openapi-maven-plugin的配置标记中指定apiDocsUrl