Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integration tests wouldn't start (Failsafe, Maven)

I'm trying to use Maven Failsafe Plugin to run my integration tests with this configuration:

 <plugin>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.7.1</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>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <version>6.1.7</version>
    <configuration>

          <connectors>
            <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
              <port>8080</port>
              <maxIdleTime>3600000</maxIdleTime>
            </connector>
          </connectors>

        <contextPath>/</contextPath>
        <scanIntervalSeconds>3</scanIntervalSeconds>
        <scanTargetPatterns>
            <scanTargetPattern>
                <directory>src/main/webapp/WEB-INF</directory>
                <excludes>
                    <exclude>**/*.jsp</exclude>
                    <exclude>**/*.html</exclude>
                </excludes>
                <includes>
                    <include>**/*.page</include>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
            </scanTargetPattern>
        </scanTargetPatterns>
    </configuration>
    <executions>
            <execution>
                <id>start-jetty</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>run-war</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>

Everything is fine until Jetty is started in pre-integration-test phase. Then nothing happens, as if it was waiting for something. The last line says:

[INFO] Started Jetty Server

How can I make the tests to start right afterwards? I run maven using mvn verify.

like image 797
John Manak Avatar asked Jan 21 '11 13:01

John Manak


2 Answers

Change of jetty maven plugin version from 6.1.7 to 6.1.26 solved everything.

like image 132
John Manak Avatar answered Oct 10 '22 02:10

John Manak


For people still looking for a solution, I had that same problem and I solved it by replacing

<goals>
     <goal>run-war</goal>
</goals>

by

<goals>
     <goal>start</goal>
</goals>

It works because run* are blocking the execution, while start is non-blocking.

like image 27
Jay Zus Avatar answered Oct 10 '22 02:10

Jay Zus