Skip to content

Instantly share code, notes, and snippets.

@mcroissant
Created April 26, 2021 14:25
Show Gist options
  • Save mcroissant/35174b400537ea07beec8bf8eb12fe35 to your computer and use it in GitHub Desktop.
Save mcroissant/35174b400537ea07beec8bf8eb12fe35 to your computer and use it in GitHub Desktop.
Maven OpenAPI Spec generation with springdoc
...
<build>
<plugins>
...
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>VERSION HERE</version>
<configuration>
<wait>2000</wait>
<jvmArguments>-Dspring.application.admin.enabled=true</jvmArguments>
</configuration>
<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>
<plugin>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-maven-plugin</artifactId>
<version>VERSION HERE</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<apiDocsUrl>http://localhost:8080/api-docs</apiDocsUrl>
<outputFileName>openapi.json</outputFileName>
<outputDir>${project.build.directory}</outputDir>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
...
</build>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment