Skip to content

Instantly share code, notes, and snippets.

@BenjaminKlatt
Created February 14, 2021 10:02
Show Gist options
  • Save BenjaminKlatt/663a62d9e89d3913bdaf375ee0943d8f to your computer and use it in GitHub Desktop.
Save BenjaminKlatt/663a62d9e89d3913bdaf375ee0943d8f to your computer and use it in GitHub Desktop.
SpringDoc OpenAPI download tomcat port configuration for integration test phase
<!-- Identify a free port for the spring boot integration test phase -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>reserve-tomcat-port</id>
<goals><goal>reserve-network-port</goal></goals>
<phase>process-resources</phase>
<configuration>
<portNames><portName>tomcat.http.port</portName></portNames>
</configuration>
</execution>
</executions>
</plugin>
<!-- Spring boot helper plugin starting and stopping the Spring Boot app -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<configuration><jvmArguments>-Dspring.application.admin.enabled=true</jvmArguments></configuration>
<executions>
<execution>
<id>pre-integration-test</id>
<goals><goal>start</goal></goals>Ursprünglichen API Entwicklung <configuration>
<arguments><argument>--server.port=${tomcat.http.port}</argument></arguments>
</configuration>
</execution>
<execution>
<id>post-integration-test</id>
<goals><goal>stop</goal></goals>
</execution>
</executions>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment