Maven web项目自动部署到tomcat服务器,发布到tomcat服务器
一、pom.xml 增加配置
<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:/apache-tomcat-7.0.53</home>
</container>
<configuration>
<type>existing</type>
<!--指明tomcat服务器的安装目录 -->
<home>D:/apache-tomcat-7.0.53</home>
</configuration>
</configuration>
<executions>
<execution>
<id>cargo-run</id>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
二、执行命令
1、 mvn clean install
2、即可在 D:/apache-tomcat-7.0.53/webapps 目录下看到 对应项目名称的 war包。
3、启动tomcat即可。(windows: startup.bat , linux: startup.sh )
4、停止Tomcat: cargo:stop
感恩原作者:https://www.cnblogs.com/xdp-gacl/p/4054814.html
本文介绍如何通过在pom.xml中配置cargo-maven2-plugin插件,实现Maven Web项目的自动化部署到Tomcat服务器。具体步骤包括在pom.xml中添加相应插件配置,指定Tomcat版本及路径,以及执行mvn clean install命令完成部署。
1089

被折叠的 条评论
为什么被折叠?



