2016-08-05 71 views
1

我在pom如何使用maven tomcat插件將war從孩子pom部署到Tomcat?

<plugin> 
    <groupId>org.apache.tomcat.maven</groupId> 
    <artifactId>tomcat7-maven-plugin</artifactId> 
    <version>2.2</version> 
    <configuration> 
     <path>/casemanager</path> 
     <update>true</update> 
    </configuration> 
</plugin> 

具有以下插件Maven項目當我做了mvn tomcat7:run,我的戰爭部署就好了。但是我對

 <plugin> 
      <groupId>org.apache.tomcat.maven</groupId> 
      <artifactId>tomcat7-maven-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>tomcat-run</id> 
        <phase>pre-integration-test</phase> 
        <goals> 
         <goal>run</goal> 
        </goals> 
        <configuration> 
         <fork> 
          true 
         </fork> 
        </configuration> 
       </execution> 
       <execution> 
        <id>tomcat-shutdown</id> 
        <goals> 
         <goal>shutdown</goal> 
        </goals> 
        <phase>post-integration-test</phase> 
       </execution> 
      </executions> 
      <configuration> 
       <fork>true</fork> 
      </configuration> 
     </plugin> 

我想讓Tomcat在pre-integration-test階段運行我的Maven項目的模塊之一以下配置。現在當我做一個mvn verify時,它啓動服務器,但沒有部署我的戰爭。我甚至嘗試提供warSourceDirectory。我在這裏錯過了什麼嗎?

回答

0

我想通了。看起來像當我在一個子pom中執行一個目標時,tomcat不會在同一級別的其他模塊中搜索戰爭。我不得不使用webapp

     <webapps> 
          <webapp> 
           <groupId>com.fico.fos.casemanager</groupId> 
           <artifactId>casemanager.ui</artifactId> 
           <version>1.0.0-SNAPSHOT</version> 
           <type>war</type> 
           <asWebapp>true</asWebapp> 
          </webapp> 
         </webapps> 

我不得不把configuration標籤中使用該