【问题标题】:How do I deploy my Maven WAR project to a Cargo-Tomcat container?如何将我的 Maven WAR 项目部署到 Cargo-Tomcat 容器?
【发布时间】:2011-10-24 20:07:57
【问题描述】:

我将 Maven 3.0.3 与 Maven-Cargo 插件 1.1.3 与 Tomcat 6.0.33 一起使用。如何使用 Maven-Cargo 将现有的 WAR 项目部署到已安装的 Tomcat 容器中?我有这个配置...

        <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <configuration>
                <wait>false</wait>
                <container>
                    <containerId>tomcat6x</containerId>
                    <type>installed</type>
                    <!-- The home folder for your local Tomcat -->
                    <home>${CATALINA_HOME}</home>
                </container>
                <configuration>
                    <type>existing</type>
                    <home>${CATALINA_HOME}</home>
                </configuration>
                <deployer>
                    <!-- You have to again specify that the type for the deployer -->
                    <type>local</type>
                    <deployables>
                        <!-- This deployable specifies the webapp you want to deploy -->
                        <deployable>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>${project.artifactId}</artifactId>
                            <type>${project.packaging}</type>
                        </deployable>
                    </deployables>
                </deployer>
            </configuration>
            <executions>
                <execution>
                    <id>start-container</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>start</goal>
                    </goals>
                </execution>
                <execution>
                    <id>stop-container</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

但是当我跑步时

mvn cargo:start clean install -DCATALINA_HOME=$CATALINA_HOME

WAR 文件没有部署到我已经运行的 Tomcat 实例(当我的集成测试针对 Tomcat 服务器运行时,我得到 404)。

感谢您的帮助,-戴夫

【问题讨论】:

    标签: maven tomcat6 cargo maven-cargo


    【解决方案1】:

    我正在使用 Maven Tomcat 插件在正在运行的 Tomcat 实例上部署 Web 应用程序 .. mvn tomcat:deploy .. 也许这也适合您?更多详情请访问plugin's website

    【讨论】:

    • 如果您想将此作为一个 Maven-Tomcat 问题,您能否展示一个在预集成阶段启动 Tomcat 服务器、在集成阶段运行 Junit Selenium 测试的示例,以及然后在集成后阶段关闭 Tomcat 服务器?
    猜你喜欢
    • 1970-01-01
    • 2013-03-27
    • 1970-01-01
    • 2015-10-20
    • 2012-01-15
    • 1970-01-01
    • 1970-01-01
    • 2011-08-16
    • 2013-08-09
    相关资源
    最近更新 更多