How to use the plugin for Integration-Tests

To run the Tomcat-Instance during 'integration-test'-phase you have to configure the plugin like the following example.

<pom>
...
...
        <build>
                <finalName>external-libs</finalName>
                <plugins>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-surefire-plugin</artifactId>
                                <version>2.12.4</version>
                        </plugin>
                        <!-- this executes the integration-test, junit-test that ends with 'IT' -->
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-failsafe-plugin</artifactId>
                                <version>2.12.4</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>
                        </plugin>
                        <plugin>
                                <groupId>com.googlecode.t7mp</groupId>
                                <artifactId>maven-t7-plugin</artifactId>
                                <version>0.9.10.M8</version>
                                <configuration>
                                        <!-- setup the port to listen on -->
                                        <tomcatHttpPort>9091</tomcatHttpPort>
                                        <!-- this is very important for integration tests -->
                                        <tomcatSetAwait>false</tomcatSetAwait>
                                </configuration>
                                <executions>
                                        <execution>
                                                <id>start-tomcat</id>
                                                <goals>
                                                        <goal>run</goal>
                                                </goals>
                                                <phase>pre-integration-test</phase>
                                        </execution>
                                        <execution>
                                                <id>stop-tomcat</id>
                                                <goals>
                                                        <goal>stop</goal>
                                                </goals>
                                                <phase>post-integration-test</phase>
                                        </execution>
                                </executions>
                        </plugin>
                </plugins>
        </build>
...
...

If you run your build, the Tomcat-Instance will be startet in the 'pre-integration-test'-phase and stopped in the 'post-integration-test'-phase. You don't have to invoke the plugin directly on commandline. All you need is the following.

mvn clean install