title: Inegration test using maven
body: <p>I am trying to create something like integration tests - i am using groovy to send requests and to parse answers. I'd also want starting of jboss and deploying of .ear to be automatically. Using cargo plugin i was able to start jboss. By using exec plugin i am trying to execute perl script that puts ear to deploy folder. Next phase - execute groovy tests, but this phase starts without waiting for ear to be deployed. Is it possible to make  phase to wait for server to be deployed to jboss? My pom: </p>
  
  <pre><code>&lt;build&gt;
      &lt;plugins&gt;
         &lt;plugin&gt;
            &lt;groupId&gt;org.codehaus.groovy.maven&lt;/groupId&gt;
            &lt;artifactId&gt;gmaven-plugin&lt;/artifactId&gt;
            &lt;executions&gt;
               &lt;execution&gt;
                  &lt;id&gt;unpack-application-server&lt;/id&gt;
                  &lt;phase&gt;pre-integration-test&lt;/phase&gt;
                  &lt;goals&gt;
                     &lt;goal&gt;execute&lt;/goal&gt;
                  &lt;/goals&gt;
                  &lt;configuration&gt;
                     &lt;source&gt;${basedir}/src/main/script/appserver/unzip.groovy&lt;/source&gt;
                     &lt;defaults&gt;
                        &lt;installDirectory&gt;${appserver.install.directory}&lt;/installDirectory&gt;
                        &lt;zipUrl&gt;${appserver.zip.url}&lt;/zipUrl&gt;
                     &lt;/defaults&gt;
                  &lt;/configuration&gt;
               &lt;/execution&gt;
  
               &lt;execution&gt;
                  &lt;id&gt;prepare-application-server-configs&lt;/id&gt;
                  &lt;phase&gt;pre-integration-test&lt;/phase&gt;
                  &lt;goals&gt;
                     &lt;goal&gt;execute&lt;/goal&gt;
                  &lt;/goals&gt;
                  &lt;configuration&gt;
                     &lt;source&gt;${basedir}/src/main/script/appserver/${suffix}/postUnzipAction.groovy&lt;/source&gt;
                  &lt;/configuration&gt;
               &lt;/execution&gt;
            &lt;/executions&gt;
         &lt;/plugin&gt;
         &lt;plugin&gt;
            &lt;groupId&gt;org.codehaus.cargo&lt;/groupId&gt;
            &lt;artifactId&gt;cargo-maven2-plugin&lt;/artifactId&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;/goals&gt;
               &lt;/execution&gt;
            &lt;/executions&gt;
  
            &lt;configuration&gt;
               &lt;wait&gt;false&lt;/wait&gt;
               &lt;container&gt;
                  &lt;containerId&gt;${appserver.id}&lt;/containerId&gt;
                  &lt;home&gt;${appserver.home}&lt;/home&gt;
                  &lt;timeout&gt;6000000&lt;/timeout&gt; &lt;!--in ms--&gt;
               &lt;/container&gt;
  
               &lt;configuration&gt;
                  &lt;properties&gt;
                     &lt;cargo.servlet.port&gt;${servlet.port}&lt;/cargo.servlet.port&gt;
                     &lt;cargo.rmi.port&gt;${rmi.port}&lt;/cargo.rmi.port&gt;
                     &lt;!-- corresponds to -Djboss.bind.address=0.0.0.0 under jboss --&gt;
                     &lt;cargo.hostname&gt;0.0.0.0&lt;/cargo.hostname&gt;
                  &lt;/properties&gt;
               &lt;/configuration&gt;
            &lt;/configuration&gt;
         &lt;/plugin&gt;
  
         &lt;plugin&gt;
            &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
            &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
            &lt;executions&gt;
               &lt;execution&gt;
                  &lt;id&gt;deploy-with-script&lt;/id&gt;
                  &lt;phase&gt;pre-integration-test&lt;/phase&gt;
                  &lt;goals&gt;
                     &lt;goal&gt;exec&lt;/goal&gt;
                  &lt;/goals&gt;
                  &lt;configuration&gt;
                     &lt;executable&gt;perl&lt;/executable&gt;
                     &lt;workingDirectory&gt;.&lt;/workingDirectory&gt;
                     &lt;commandlineArgs&gt;${deploy.pl.cmd} -x redeploy&lt;/commandlineArgs&gt;
                  &lt;/configuration&gt;
               &lt;/execution&gt;
            &lt;/executions&gt;
         &lt;/plugin&gt;
      &lt;/plugins&gt;
   &lt;/build&gt;
  </code></pre>