How do I deploy my Maven WAR project to a Cargo-Tomcat container?

1.9k Views Asked by At

I'm using Maven 3.0.3 with the Maven-Cargo plugin 1.1.3 with Tomcat 6.0.33. How do I deploy my existing WAR project to an installed Tomcat container using Maven-Cargo? I have this configuration ...

        <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>

but when I run

mvn cargo:start clean install -DCATALINA_HOME=$CATALINA_HOME

the WAR file doen't get deployed to my already-running Tomcat instance (I get 404s when my integration tests run against the Tomcat server).

Thanks for your help, - Dave

1

There are 1 best solutions below

1
On

I am using the Maven Tomcat Plugin to deploy web applications on a running Tomcat instance .. mvn tomcat:deploy .. perhaps this is working for you, too? more details to be found at the plugin's website