title: Maven: How do I configure tests to run in integration-test phase?
body: <p>I'm using Maven 3.0.3.  I want to run some Junit tests in my test phase and others in my integration-test phase.  Problem is nothing is running during the integration-test phase.  I run the command</p>
  
  <pre><code>mvn clean install
  </code></pre>
  
  <p>to kick everything off.  Here is how I've configured my surefire-plugin ...</p>
  
  <pre><code>        &lt;plugin&gt;
              &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.6&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;skip&gt;false&lt;/skip&gt;
                  &lt;additionalClasspathElements&gt;
                      &lt;additionalClasspathElement&gt;${project.build.sourceDirectory}&lt;/additionalClasspathElement&gt;
                      &lt;additionalClasspathElement&gt;${project.build.testSourceDirectory}&lt;/additionalClasspathElement&gt;
                  &lt;/additionalClasspathElements&gt;
                  &lt;useManifestOnlyJar&gt;false&lt;/useManifestOnlyJar&gt;
                  &lt;forkMode&gt;always&lt;/forkMode&gt;
                  &lt;systemProperties&gt;
                      &lt;property&gt;
                          &lt;name&gt;gwt.args&lt;/name&gt;
                          &lt;value&gt;-out \${webAppDirectory}&lt;/value&gt;
                      &lt;/property&gt;
                  &lt;/systemProperties&gt;
                  &lt;excludes&gt;
                      &lt;exclude&gt;**/integration/**&lt;/exclude&gt;
                  &lt;/excludes&gt; 
              &lt;/configuration&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;integration-test&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;test&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;skip&gt;false&lt;/skip&gt;
                          &lt;includes&gt;
                              &lt;include&gt;**/integration/**&lt;/include&gt;
                          &lt;/includes&gt; 
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>I have two JUnit tests in my "integration" directory.  I'm using the Maven Cargo plugin to spin up a server during the integration phase.  Here is that configuration ...</p>
  
  <pre><code>        &lt;plugin&gt;
              &lt;groupId&gt;org.codehaus.cargo&lt;/groupId&gt;
              &lt;artifactId&gt;cargo-maven2-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;container&gt;
                      &lt;containerId&gt;tomcat${tomcat.major}x&lt;/containerId&gt;
                      &lt;zipUrlInstaller&gt;
                          &lt;url&gt;http://archive.apache.org/dist/tomcat/tomcat-${tomcat.major}/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.tar.gz&lt;/url&gt;
                          &lt;downloadDir&gt;${project.build.directory}/downloads&lt;/downloadDir&gt;
                          &lt;extractDir&gt;${project.build.directory}/extracts&lt;/extractDir&gt;
                      &lt;/zipUrlInstaller&gt;
                      &lt;output&gt;${project.build.directory}/tomcat${tomcat.major}x.log&lt;/output&gt;
                      &lt;log&gt;${project.build.directory}/cargo.log&lt;/log&gt;
                  &lt;/container&gt;
                  &lt;configuration&gt;
                      &lt;home&gt;${project.build.directory}/tomcat-${tomcat.version}/container&lt;/home&gt;
                      &lt;properties&gt;
                          &lt;cargo.logging&gt;high&lt;/cargo.logging&gt;
                          &lt;cargo.servlet.port&gt;${tomcat.servlet.port}&lt;/cargo.servlet.port&gt;
                          &lt;cargo.tomcat.ajp.port&gt;${tomcat.ajb.port}&lt;/cargo.tomcat.ajp.port&gt;
                      &lt;/properties&gt;
                  &lt;/configuration&gt;
              &lt;/configuration&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;start-container&lt;/id&gt;
                      &lt;phase&gt;pre-integration-test&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;start&lt;/goal&gt;
                          &lt;goal&gt;deploy&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;deployer&gt;
                              &lt;deployables&gt;
                                  &lt;deployable&gt;
                                      &lt;groupId&gt;${project.groupId}&lt;/groupId&gt;
                                      &lt;artifactId&gt;${project.artifactId}&lt;/artifactId&gt;
                                      &lt;type&gt;war&lt;/type&gt;
                                      &lt;pingURL&gt;http://localhost:${tomcat.servlet.port}/${project.artifactId}&lt;/pingURL&gt;
                                      &lt;pingTimeout&gt;30000&lt;/pingTimeout&gt;
                                      &lt;properties&gt;
                                          &lt;context&gt;${project.artifactId}&lt;/context&gt;
                                      &lt;/properties&gt;
                                  &lt;/deployable&gt;
                              &lt;/deployables&gt;
                          &lt;/deployer&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
                  &lt;execution&gt;
                      &lt;id&gt;stop-container&lt;/id&gt;
                      &lt;phase&gt;post-integration-test&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;stop&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>Any ideas how I change/enhance my configuration so that my integration tests will run? - Dave</p>