6

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.

A_Di-Matteo
  • 26,902
  • 7
  • 94
  • 128
John Manak
  • 13,328
  • 29
  • 78
  • 119

2 Answers2

2

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.

Jay Zus
  • 573
  • 5
  • 19
2

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

John Manak
  • 13,328
  • 29
  • 78
  • 119
  • I was facing the same issue. I also upgraded the version to 6.1.26, Still, my integration tests are not running. Last line is : [INFO] Started Jetty Server. After that, nothing happens. Maven clean install step gets stuck that. Any idea why that is happening? – Tarun Kumar Apr 25 '13 at 08:39
  • I have the same problem with the version 9.4.4.v20170414. the @Jay Zus's solution is the correct – xedo Apr 23 '17 at 19:39