1

根据本指南,我正在尝试使用 Maven Failsafe Plugin 运行我的功能/集成测试:http://docs.codehaus.org/display/MAVENUSER/Maven+and+Integration+Testing,章节Using the Maven Failsafe Plugin运行集成测试

但是,码头并没有在预集成测试阶段开始,因此所有测试都失败了。以下POM配置是否有问题:

<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>

我运行集成测试mvn verify

4

1 回答 1

0

我知道为什么 - 首先我将execution标签放在另一个execution标签内(而不是executions),然后这个executions块不应该在configuration标签内,而是在它之外,就在plugin标签内。

于 2011-01-21T13:43:18.940 回答