gpt4 book ai didi

java - Jetty 未在预集成测试阶段启动 (Maven)

转载 作者:行者123 更新时间:2023-11-28 20:58:09 25 4
gpt4 key购买 nike

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

但是,jetty 并未在预集成测试阶段启动,因此所有测试均失败。下面的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 运行集成测试

最佳答案

我知道为什么 - 首先我将 execution 标签放在另一个 execution 标签中(而不是 executions)然后这个 executions block 不应位于 configuration 标记内,而应位于其外部,位于 plugin 标记内。

关于java - Jetty 未在预集成测试阶段启动 (Maven),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4759310/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com