Question

I'm trying to use Maven Failsafe Plugin to run my functional/integration tests, according to this guide: http://docs.codehaus.org/display/MAVENUSER/Maven+and+Integration+Testing, chapter Using the Maven Failsafe Plugin to run Integration Tests

However, jetty doesn't start in the pre-integration-test phase and thus all the tests fail. Is there any problem in the following POM configuration:

<plugin>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.7.1</version>
    <executions>
      <execution>
        <goals>
          <goal>integration-test</goal>
          <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>
        <execution>
            <execution>
                <id>start-jetty</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>run-exploded</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>
        </execution>

    </configuration>
</plugin>

I run the integration tests by mvn verify

Was it helpful?

Solution

I know why - first I put the execution tags inside another execution tag (instead of executions) and then this executions block shouldn't be inside configuration tag, but outside of it, right inside the plugin tag.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top