如何将Maven WAR项目部署到Cargo-Tomcat容器?

时间:2011-10-24 20:07:57

标签: maven tomcat6 cargo maven-cargo

我正在使用带有Tomcat 6.0.33的Maven-Cargo插件1.1.3的Maven 3.0.3。如何使用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服务器运行时,我得到404s。)

感谢您的帮助, - 戴夫

1 个答案:

答案 0 :(得分:0)

我正在使用Maven Tomcat插件在正在运行的Tomcat实例上部署Web应用程序.. mvn tomcat:deploy ..也许这对你有用吗?更多细节可在plugin's website

找到