Deploying the WAR for Testing
Just like explained in deploying web projects locally, it is possible to run a web server during the integration tests, by anchoring the plugins execution to the verify phase.
Jetty
When using the Jetty plugin with Maven use this configuration:
<plugin>
<!-- Jetty -->
<!-- Jetty will run the web service during the integration
tests -->
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${plugin.jetty.version}</version>
<configuration>
<stopKey>STOP</stopKey>
<stopPort>9999</stopPort>
<stopWait>5</stopWait>
<webApp>
<contextPath>${server.test.path}</contextPath>
</webApp>
</configuration>
<executions>
<execution>
<id>start-jetty-it</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
<useTestScope>true</useTestScope>
<webApp>
<overrideDescriptor>${project.build.directory}/${project.build.finalName}/WEB-INF/web.xml</overrideDescriptor>
</webApp>
</configuration>
</execution>
<execution>
<id>stop-jetty-it</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>Tomcat
When using the Tomcat plugin with Maven use this configuration:
Last updated
Was this helpful?