maven web配置发布路径 cargo自动部署项目到tomcat

时间:2024-04-22 11:05:41

pom.xml中加入以下 配置发布路径

 <build>
<!-- 发布名 www.locathost:8080/HelloWeb可以访问,如果改成ROOT那么 默认的tomcat也就能访问了 -->
<finalName>HelloWeb</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.2.3</version>
<configuration>
<container>
<!-- tomcat类型 -->
<containerId>tomcat7x</containerId>
<!-- 指定tomcat路径 -->
<home>D:\Program Files\Java\Apache Tomcat\apache-tomcat-7.0.37-windows-x86\apache-tomcat-7.0.37</home>
</container>
<configuration>
<type>existing</type>
<!-- 指定tomcat路径 -->
<home>D:\Program Files\Java\Apache Tomcat\apache-tomcat-7.0.37-windows-x86\apache-tomcat-7.0.37</home>
</configuration> </configuration>
<executions>
<execution>
<id>cargo-run</id>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>