Springdoc-openapi Plugins
Maven plugin
The aim of springdoc-openapi-maven-plugin
is to generate json and yaml OpenAPI description during build time.
The plugin works during integration-tests phase, and generate the OpenAPI description.
The plugin works in conjunction with spring-boot-maven plugin.
You can test it during the integration tests phase using the maven command:
mvn verify
In order to use this functionality, you need to add the plugin declaration on the plugins section of your pom.xml:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot-maven-plugin.version}</version>
<configuration>
<jvmArguments>-Dspring.application.admin.enabled=true</jvmArguments>
</configuration>
<executions>
<execution>
<goals>
<goal>start</goal>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
For more custom settings of the springdoc-openapi-maven-plugin, you can consult the plugin documentation:
Gradle plugin
This plugin allows you to generate an OpenAPI 3 specification for a Spring Boot application from a Gradle build.
plugins {
id("org.springframework.boot") version "3.1.2"
id("org.springdoc.openapi-gradle-plugin") version "1.9.0"
}
When you add this plugin and its runtime dependency plugins to your build file, the plugin creates the following tasks:
-
forkedSpringBootRun
-
generateOpenApiDocs
gradle clean generateOpenApiDocs
For more custom configuration of springdoc-openapi-gradle-plugin
,you can consult the plugin documentation: