don't dream your life, live your dreams !
Jetty maven plugin allows you to deploy your webapp in jetty.
Here is an example that shows how to deploy your webapp in jetty and launch integration tests.
We ask maven to fire the goal ‘deploy-war’ at the phase ‘pre-integration-test’ to deploy the webapp in jetty.
This will have the benefit to be able to launch integration tests at the phase ‘integration_test’.
Then we will fire the goal ‘stop’ at the phase ‘post-integration-test’ to stop the container.
<plugins> (...) <plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>${jetty-maven.version}</version> <configuration> <webApp> <contextPath>/</contextPath> </webApp> <httpConnector> <port>8080</port> </httpConnector> <scanIntervalSeconds>10</scanIntervalSeconds> <stopPort>9005</stopPort> <stopKey>STOP</stopKey> </configuration> <executions> <execution> <id>start-jetty</id> <phase>pre-integration-test</phase> <goals> <goal>deploy-war</goal> </goals> </execution> <execution> <id>stop-jetty</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> </plugin> (...) </plugins> |
When the container is started, we launch maven-failsafe-plugin goal ‘integration-test’ at phase ‘integration-test’.
<plugins> (...) <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>${maven-failsafe.version}</version> <executions> <execution> <id>integration-test</id> <goals> <goal>integration-test</goal> </goals> </execution> <execution> <id>verify</id> <goals> <goal>verify</goal> </goals> </execution> </executions> <configuration> <encoding>UTF-8</encoding> </configuration> </plugin> (...) </plugins> |
Copyright © 2025 My linux world - by Marc RABAHI
Design by Marc RABAHI and encelades.
admin