Maven web项目自动部署到tomcat服务器,发布到tomcat服务器

本文介绍如何通过在pom.xml中配置cargo-maven2-plugin插件,实现Maven Web项目的自动化部署到Tomcat服务器。具体步骤包括在pom.xml中添加相应插件配置,指定Tomcat版本及路径,以及执行mvn clean install命令完成部署。

                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

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值