我有一个webapp我试图运行集成测试。它运行良好,通常部署到Web服务器。但是,在使用Maven和Tomcat插件进行集成测试时,它会无限期地挂在这个位置。
Aug 28, 2015 12:14:52 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.19 02/11/2015 05:39 AM'
Aug 28, 2015 12:14:52 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
我有点忘了,现在已经在这个地方待了大约2个小时,所以我确定这不是一个耐心的问题。
这是Tomcat和Failsafe的配置
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>failsafe-maven-plugin</artifactId>
<version>2.4.3-alpha-1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<id>start-tomcat</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>stop-tomcat</id>
<phase>post-integration-test</phase>
<goals>
<goal>shutdown</goal>
</goals>
</execution>
</executions>
</plugin>
为什么会发生这种情况?
答案 0 :(得分:1)
我能够在最后模拟你的问题。您需要为fork=true
指定tomcat7:run
。这将允许maven在调用运行目标后继续执行。
<execution>
<id>start-tomcat</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<fork>true</fork>
</configuration>
</execution>