2016-08-05 107 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标签中使用该