2011-06-10 70 views

回答

1

你可以嘗試使用maven-antrun-plugin到你的戰爭複製到Tomcat這樣的部署目錄:

<build> 
    <plugins> 
     <plugin> 
      <artifactId>maven-antrun-plugin</artifactId> 
      <version>1.6</version> 
      <executions> 
       <execution> 
        <phase>install</phase> 
        <configuration> 
         <target> 
          <copy file="{project.build.directory}/${project.actifactId}-${project.version}.war" tofile="<your tomcat path>/${project.actifactId}-${project.version}.war" /> 
         </target> 
        </configuration> 
        <goals> 
         <goal>run</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 
+0

太棒了:) Thnx – 2011-06-10 08:21:16

1

也許你不需要複製戰爭文件,如果你嘗試Maven Jetty Plugin。該插件用於直接從Maven運行Web應用程序。

+0

我不希望它運行,這是一個portlet,我想放置到liferay-tomcat-bundle的deploy文件夾中以進行熱部署:) – 2011-06-10 07:41:38

1

嘗試cargo-maven2-plugin。也許像這樣的工作:

<plugin> 
    <groupId>org.codehaus.cargo</groupId> 
    <artifactId>cargo-maven2-plugin</artifactId> 
    <executions> 
    <execution> 
     <id>deploy-local</id> 
     <phase>install</phase> 
     <goals> 
     <goal>deployer-deploy</goal> 
     <goals> 
    </execution> 
    </executions> 
    <configuration> 
    <container> 
     <containerId>tomcat6x</containerId> 
    </container> 
    <configuration> 
     <type>existing</type> 
     <home>/your/tomcat/dir</home> <!-- replace as needed --> 
    </configuration> 
    </configuration> 
</plugin> 

...摑到這一個配置文件或頂層<build><plugins>部分,看看它是否適合你...

+0

如何指定我的.war文件的名稱?因爲它不是項目的名稱+版本? – 2011-06-10 08:29:47

+0

我想默認情況下它會使用你聲明的'finalName'值。但我不完全確定。 – 2011-06-10 18:05:14

相關問題