2016-04-22 31 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> 
相關問題