I have done some integration tests using Selenium, so I have defined a goal on pre-integration-test phase so I:
- Start a Jetty
- Deploy the app
- Perform tests
- Stop the Jetty
This runs fine in my local server.
However, now I am deploying the app to a dev server with tomcat, and I want this tests to be executed with this tomcat, not with Jetty, and my build fails trying to start Jetty on the same port as tomcat (8080). I am executing a mvn package.
Is there any parameter in maven I can use to skip this goal from being executed?
This is the snippet I am using to start the server before the integration tests:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<stopKey>foo</stopKey>
<stopPort>9999</stopPort>
<contextPath>/</contextPath>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
You can solve your problems with maven profiles. Create a profile for Jetty container and a separate profile for Tomcat