您的位置:首页 > 运维架构 > Tomcat

cargo-maven2-plugin上传部署到tomcat服务器

2017-03-28 16:08 483 查看
使用的是cargo-maven2-plugin插件,较为灵活的一个Deploy插件,具体配置如比上面的tomcat-maven-plugin稍微有点儿复杂,部分还有不清楚,先写上以后再慢慢研究,配置如下:

Xml代码  


<build>         
        <plugins>  
        <plugin>  
            <!-- 指定插件名称及版本号 -->  
            <groupId>org.codehaus.cargo</groupId>  
            <artifactId>cargo-maven2-plugin</artifactId>  
            <version>1.0.3</version>  
              
            <!-- 插件的Tomcat6.x配置 -->  
            <configuration>  
                <wait>true</wait>       <!--是否说明,操作start、stop等后续操作必须等前面操作完成才能继续-->  
                <container>               <!-- 容器的配置 -->  
                    <containerId>tomcat6x</containerId>              
<!-- 指定tomcat版本  -->  
                    <type>installed</type>                                  <!-- 指定类型:standalone, installed等 -->  
                    <home>E:\webServers\apache-tomcat-6.0.32-test</home>    <!-- 指定Tomcat的位置,即catalina.home -->  
                </container>  
                  
                <configuration>           <!-- 具体的配置 -->  
                    <type>existing</type>                                   <!-- 类型,existing:存在 -->  
                    <home>E:\webServers\apache-tomcat-6.0.32-test</home>    <!-- Tomcat的位置,即catalina.home -->  
                    <properties>                                          <!-- 配置属性 -->  
                        <cargo.tomcat.manager.url>http://localhost:8080/manager</cargo.tomcat.manager.url>      <!-- 管理地址 -->  
                        <cargo.remote.username>tomcat</cargo.remote.username>                                   <!-- Tomcat用户名 -->  
                        <cargo.remote.password>tomcat</cargo.remote.password>                                   <!-- Tomcat密码 -->  
                        <cargo.tomcat.ajp.port>8009</cargo.tomcat.ajp.port>                                     <!-- Ajp端口 -->  
                    </properties>  
                </configuration>  
                  
                <deployer>                                            <!-- 部署配置 -->  
                    <type>installed</type>                          <!-- 类型 -->  
                    <deployables>                                 <!-- 部署设置 -->  
                        <deployable>                              <!-- 部署的War包名等 -->                  
                            <groupId>org.test</groupId>  
                            <artifactId>testwebapp</artifactId>  
                            <type>war</type>  
                            <properties>  
                                <context>testwebapp</context>   <!-- 部署路径 -->  
                            </properties>  
                        </deployable>  
                    </deployables>  
                </deployer>  
            </configuration>  
              
            <executions>  
                <!-- 执行的动作 -->  
                <execution>  
                    <id>verify-deployer</id>  
                    <phase>install</phase>      <!-- 解析install -->  
                    <goals>  
                        <goal>deployer-deploy</goal>  
                    </goals>  
                </execution>  
                  
                <execution>  
                    <id>clean-deployer</id>  
                    <phase>clean</phase>  
                    <goals>  
                        <goal>deployer-undeploy</goal>  
                    </goals>  
                </execution>  
            </executions>  
        </plugin>  
    </plugins>  
</build>  

不详细的解释在XML当中,直接运行mvn install OK!~~
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: