2016-04-22 64 views
1

经过两天的搜索之后,我仍然无法在测试之前运行tomcat,谁能告诉我我做得不对?这里是我的POM如何在开始测试之前运行tomcat

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-failsafe-plugin</artifactId> 
    <version>2.16</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.apache.tomcat.maven</groupId> 
<artifactId>tomcat7-maven-plugin</artifactId> 
<version>2.2</version> 
<configuration> 
    <server>tomcat-development-server</server> 
    <port>8081</port> 
    <path>/test</path> 
</configuration> 
<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> 

,当我用MVN验证我的测试开始 ,但服务器不,我不知道我错过了什么!

回答

0

i加在预集成测试阶段添加该代码解决了这个问题

<configuration> 
     <fork>true</fork> 
</configuration> 
相关问题